现在的位置: 首页 > 综合 > 正文

Android EditText密码框中字体和普通的输入框不同

2014年01月07日 ⁄ 综合 ⁄ 共 407字 ⁄ 字号 评论关闭

 

先看图,用户名和密码框中的英文字体是不同的:(注意看)

stack overflow上看到的一个问答贴,解决方法如下:

http://stackoverflow.com/questions/3406534/password-hint-font-in-android

下面是我用的方法,经过测试OK。

 Leave android:password="true" in
your xml. In Java, ALSO set the typeface and passwordMethod:

EditText password = (EditText) findViewById(R.id.register_password_text);
password.setTypeface(Typeface.DEFAULT);
password.setTransformationMethod(new PasswordTransformationMethod());

 

抱歉!评论已关闭.