紧张了几个月的奋战终于项目到了测试阶段,真是泪奔啊,回想这段时间的地狱生涯 真实汗颜啊~~~~,闲话不多说了,看图说话,
问题,相信这张图片已经展示的很明白了
下来在来看看我的代码
<EditText android:id="@+id/account_et" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_toRightOf="@+id/account_iv" android:layout_centerVertical="true" android:background="@null" android:singleLine="true"android:hint="请输入帐号" android:textColorHint="@color/color_b0b0b0"android:textSize="13sp" />
<EditText android:id="@+id/password_et" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_toRightOf="@+id/password_iv" android:background="@null" android:singleLine="true" android:hint="请输入密码"android:inputType="textPassword"android:textColorHint="@color/color_b0b0b0" android:textSize="13sp" /><EditText android:id="@+id/password_et_again" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_toRightOf="@+id/password_iv_again" android:background="@null" android:singleLine="true" android:hint="请再次输入密码" android:textColorHint="@color/color_b0b0b0" android:textSize="13sp" />下面的代码都是一样的,我就没有贴出来。看看这个代码貌似没有什么问题,
平常也一直都是这样写的。其实这样写并没有错,只是我们这样写hint的字体是
android系统默认的,如果我们在给手机上面下载一个字体样式,就会出现上面图片显示的问题,
新下载的字体样式应用不到hint上面的字体样式。hint的字体还是原来系统默认的字体,测试后发现只要加上android:inputType="textPassword" 这行代码就会出现问题。要想解决这样的问题,让hint的字体也显示成我们下载的字体样式。其实也不难 下面这两行代码也许可以解决,
在onCreate方法出初始化EditText控件时候 加上着两行就okmPasswordEt.setTypeface(Typeface.DEFAULT); mPasswordEt.setTransformationMethod(new PasswordTransformationMethod());
加上着两行就ok,图就不贴了
想要给那个控件添加 也是同样的方法,好了 然后运行一下程序,换一个下载的字体样式
会发现显示都是一样的了