一、打勾显示输入的密码

 

private EditText et;
	private CheckBox cb;
	
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.password);
		
		et = (EditText)findViewById(R.id.editText1);
		cb = (CheckBox)findViewById(R.id.checkBox1);
		
		cb.setOnCheckedChangeListener(new OnCheckedChangeListener(){

			public void onCheckedChanged(CompoundButton buttonView,
					boolean isChecked) {
				if(cb.isChecked()){
					et.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
				}
				else{
					et.setTransformationMethod(PasswordTransformationMethod.getInstance());
				}
			}
			
		});
	}
 


EditText控间的运用
 
EditText控间的运用

 

实时监视EditText内输入的字符

mEditText1.addTextChangedListener(new TextWatcher(){

			public void afterTextChanged(Editable s) {
				
			}

			public void beforeTextChanged(CharSequence s, int start, int count,
					int after) {
				
			}

			public void onTextChanged(CharSequence s, int start, int before,
					int count) {
				
			}
			
		});
 

相关文章:

  • 2021-07-31
  • 2022-02-06
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-17
  • 2021-11-09
猜你喜欢
  • 2021-06-05
  • 2021-12-03
  • 2022-01-04
  • 2021-07-30
  • 2021-12-12
  • 2021-08-15
  • 2022-02-12
相关资源
相似解决方案