如何更改搜索视图建议的字体? [英] How can I change the font of Search view suggestion?
本文介绍了如何更改搜索视图建议的字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我搜索了几个小时,他们建议使用自定义光标适配器.但是我正在使用内容提供程序来填写建议并且没有任何光标适配器.我现在可以找到 AutoCompleteTextView 并更改可编辑文本视图的字体,但我想对建议做同样的事情.我该怎么办?
I searched for hours all they suggest is using customized cursor adapter. however I'm using content provider to fill the suggestion and don't have any cursor adapter . I'm able to find AutoCompleteTextView and change the font of the editable text view now, but I want to do the same for the suggestions. What should I do?
推荐答案
您将从 sdk 获得 textview
的句柄,然后更改它,因为他们不会公开它.
You would get a handle to the textview
from the sdk and then change it since they don't expose it publicly.
试试这个代码:
int id = searchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null);
TextView textView = (TextView) searchView.findViewById(id);
Typeface type = Typeface.createFromAsset(getAssets(),"fonts/Kokila.ttf");
textView.setTypeface(type);
这篇关于如何更改搜索视图建议的字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文