[英]Set text colour of android.widget.SearchView
I am adding a android.widget.SearchView
to a view in code but I cannot find how to set the text colour for this. 我在代码中的视图中添加了一个
android.widget.SearchView
,但是我找不到如何为此设置文本颜色。
SearchView = new SearchView(getContext());
I see that there are methods to set the text alignment and direction. 我看到有一些方法可以设置文本的对齐方式和方向。
I also see that I can set the background colour and tint but nothing for the foreground. 我还看到我可以设置背景颜色和色调,但不设置前景。
Try This 尝试这个
int id = searchView.getContext().getResources().getIdentifier("android:id/search_src_text", null,
null);
TextView textView = (TextView) searchView.findViewById(id);
textView.setTextColor(Color.WHITE);
Is it possible to change the textcolor on an Android SearchView? 是否可以在Android SearchView上更改文本颜色?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.