android edittext password hint字体和普通输入框不同

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/itluochen/article/details/77449121
  1. EditText password = (EditText) findViewById(R.id.register_password_text);  
  2. password.setTypeface(Typeface.DEFAULT);  
  3. password.setTransformationMethod(new PasswordTransformationMethod());  
此外需要去除xml中的android:password="true"语句
 /* show the password*/

password.setTransformationMethod(HideReturnsTransformationMethod.getInstance())

/* hide the password */

password.setTransformationMethod(PasswordTransformationMethod.getInstance());

EditText设置只能输入字母和数字,于是乎 我们可以这么做,把输入方式设置为数字,然后给edittext添加一些限制
 Android:inputType="number"
 android:digits="1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"
给edittext添加这两个属性,就能满足我们的需求了.这时inputType并没有起到什么作用,唯一的作用就是限制软键盘弹出来的时候是数字面板了
 
  
 
  
 
 
  1. EditText password = (EditText) findViewById(R.id.register_password_text);  
  2. password.setTypeface(Typeface.DEFAULT);  
  3. password.setTransformationMethod(new PasswordTransformationMethod());  
此外需要去除xml中的android:password="true"语句
 /* show the password*/

password.setTransformationMethod(HideReturnsTransformationMethod.getInstance())

/* hide the password */

password.setTransformationMethod(PasswordTransformationMethod.getInstance());

EditText设置只能输入字母和数字,于是乎 我们可以这么做,把输入方式设置为数字,然后给edittext添加一些限制
 Android:inputType="number"
 android:digits="1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"
给edittext添加这两个属性,就能满足我们的需求了.这时inputType并没有起到什么作用,唯一的作用就是限制软键盘弹出来的时候是数字面板了
 
 

猜你喜欢

转载自blog.csdn.net/itluochen/article/details/77449121