編輯:關於Android編程
package com.banana.k08.home; import android.app.Activity; import android.os.Bundle; import android.text.method.HideReturnsTransformationMethod; import android.text.method.PasswordTransformationMethod; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity { private EditText id,password; private CheckBox cb; private Button btn1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); id = (EditText) findViewById(R.id.tv1); password = (EditText) findViewById(R.id.password); cb = (CheckBox) findViewById(R.id.check); //設置選擇是否顯示密碼 cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if(cb.isChecked()){ password.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); } else{ password.setTransformationMethod(PasswordTransformationMethod.getInstance()); } } }); findViewById(R.id.btnl).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String name = id.getText().toString(); String pass = password.getText().toString(); if (name.equals(admin) && pass.equals(admin)) { Toast.makeText(getApplicationContext(),登陸成功,Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getApplicationContext(), 登陸失敗,請重新輸入, Toast.LENGTH_SHORT).show(); } } }); } }
前言回過頭來審視之前做過的Android項目,發覺自己重新開發時忽然間不知所措了,間隔了太長時間沒有開發導致自己的Android技能知識急劇下降。溫故而知新。廢話少說,進
創建Window在Activity的attach方法中通過調用PolicyManager.makeNewWindo創建Window,將一個View add到WindowM
Android Window、PhoneWindow、WindowManager、Activity學習心得 第一彈閱讀本文,你首先需要理解 Context 上下文環境,W
昨天,華為榮耀V8已經在華為商城和京東上正式開賣了,榮耀V8是華為榮耀推出的全新V系列手機,它采用了雙卡雙待的模式,擁有5.7英寸大屏,配備了2K分辨率顯示