Android EditText提示使用与EditText相同的字体 [英] Android EditText hint uses the same font that the EditText has

查看:202
本文介绍了Android EditText提示使用与EditText相同的字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为EditText定义了一个字体,现在EditText提示也显示了该字体,但我需要为EditText提示使用不同的字体,有没有办法实现这个?

I have defined a font for a EditText and now the EditText hint also shows that font, but i need to use a different font for EditText hint, is there a way to achieve this?

推荐答案


Android EditText提示使用与EditText相同的字体

Android EditText hint uses the same font that the EditText has

EditText使用 textview_hint 布局来显示 ErrorPopup popup message.so尝试设置不同的字体提示为:

EditText uses textview_hint layout to show ErrorPopup popup message.so try as to set different typeface for Hint as:

 LayoutInflater inflater = LayoutInflater.from(<Pass context here>);
 TextView hintTextView = (TextView) inflater.inflate(
                        com.android.internal.R.layout.textview_hint, null);
 hintTextView.setTypeface(< Typeface Object>);

编辑:
因为 EdiText 使用 ErrorPopup 在内部显示Hint弹出窗口。

Because EdiText internally show Hint popup using ErrorPopup.

有关更多帮助,请参阅以下链接:

See following link for more help:

http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android /5.1.1_r1/android/widget/Editor.java#Editor.invalidateTextDisplayList%28%29

这篇关于Android EditText提示使用与EditText相同的字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆