inputType="password",font changed
来源:互联网 发布:log4j 日志写入数据库 编辑:程序博客网 时间:2024/06/11 21:43
项目中遇到金立手机,修改密码时,密码输入框hint文字英文符号字体不一致;
跳转到TextView中setInputType 方法,为password时设置的MONOSPACE;
所以只需要在代码中重新设置Typeface,setTypeface(Typeface.DEFAULT)
public void setInputType(int type) { final boolean wasPassword = isPasswordInputType(getInputType()); final boolean wasVisiblePassword = isVisiblePasswordInputType(getInputType()); setInputType(type, false); final boolean isPassword = isPasswordInputType(type); final boolean isVisiblePassword = isVisiblePasswordInputType(type); boolean forceUpdate = false; if (isPassword) { setTransformationMethod(PasswordTransformationMethod.getInstance()); setTypefaceFromAttrs(null /* fontFamily */, MONOSPACE, 0); } else if (isVisiblePassword) { if (mTransformation == PasswordTransformationMethod.getInstance()) { forceUpdate = true; } setTypefaceFromAttrs(null /* fontFamily */, MONOSPACE, 0); } else if (wasPassword || wasVisiblePassword) { // not in password mode, clean up typeface and transformation setTypefaceFromAttrs(null /* fontFamily */, -1, -1); if (mTransformation == PasswordTransformationMethod.getInstance()) { forceUpdate = true; } } //........ }
private void setTypefaceFromAttrs(String familyName, int typefaceIndex, int styleIndex) { Typeface tf = null; if (familyName != null) { tf = Typeface.create(familyName, styleIndex); if (tf != null) { setTypeface(tf); return; } } switch (typefaceIndex) { case SANS: tf = Typeface.SANS_SERIF; break; case SERIF: tf = Typeface.SERIF; break; case MONOSPACE: tf = Typeface.MONOSPACE; break; } setTypeface(tf, styleIndex); }
阅读全文
0 0
- inputType="password",font changed
- android:password is deprecated: Use inputType instead
- android:password is deprecated: Use inputType instead
- EditText -- password 与 text InputType 转换
- inputtype
- Android EditText的inputType为Password时, 字体不一致的问题
- font
- font
- Font
- font
- font
- font
- font
- font
- Font
- font
- FONT
- FONT
- 报错处理:Expression parameters.formName is undefined on line xx, column xx in xx/xx/doubleselect.ft
- 诡异的二叉树的中序遍历二
- HashMap的存储原理
- Python基础(7)——名片管理系统(实现了数据简单的存储、修改、删除、查看等)
- pulltorefresh 轻松改变 上啦和下拉的样式
- inputType="password",font changed
- 仿IOS回弹效果支持任何控件
- 解决jsp上传文件,重启tomcat后文件和文件夹自动删除
- 阿里 otter搭建过程整理
- Android 读写文件转为String[]
- JAVA 关于String的CompareTo方法即字典序比较
- 流媒体加密
- 无法启动hiveserver的解决方法
- 利用sessionStorage判断页面关闭还是刷新