设置不同的android:inputTye属性导致 EditText hint的字体发生改变

Posted X-Bing

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了设置不同的android:inputTye属性导致 EditText hint的字体发生改变相关的知识,希望对你有一定的参考价值。

1 在使用EditText控件时,经常需要指定android:inputType属性,比如用户名输入框,密码输入框等。  

而不同的android:inputType属性有时候会有使用不同的字体

EditText etPassword = findViewById(R.id.etPassword);

etPassword.setTypeface(Typeface.DEFAULT);

etPassword.setTransformationMethod(new PasswordTransformationMethod());

通过上面的两行代码就能够将密码输入框hint的字体设置跟用户名输入框的一致

以上是关于设置不同的android:inputTye属性导致 EditText hint的字体发生改变的主要内容,如果未能解决你的问题,请参考以下文章