小眼睛代码
ImageView eye1; //定义控件 eye1 = findViewById(R.id.eye1); //绑定控件 eye1.setImageResource(R.drawable.baseline_remove_red_eye_24_close); //选择初始样貌为闭眼 eye1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { switch (v.getId()) { case R.id.eye1: if (hide) { hide = false; eye1.setImageResource(R.drawable.baseline_remove_red_eye_24); //可见样貌 HideReturnsTransformationMethod method = HideReturnsTransformationMethod.getInstance(); //可见 mima.setTransformationMethod(method); } else { eye1.setImageResource(R.drawable.baseline_remove_red_eye_24_close); //不可见样貌 hide = true; TransformationMethod method = PasswordTransformationMethod.getInstance(); //隐藏 mima.setTransformationMethod(method); } int index = mima.getText().toString().length(); mima.setSelection(index); break; } } });
标签:总结,eye1,eye,baseline,16,mima,23.3,method,red From: https://www.cnblogs.com/laobing6214/p/17224310.html