【问题标题】:Set text colour of android.widget.SearchView设置 android.widget.SearchView 的文本颜色
【发布时间】:2014-10-27 12:09:37
【问题描述】:

我在代码视图中添加了android.widget.SearchView,但我找不到如何为此设置文本颜色。

SearchView = new SearchView(getContext());

我看到有设置文本对齐和方向的方法。

我还看到我可以设置背景颜色和色调,但不能设置前景。

【问题讨论】:

标签: java android


【解决方案1】:

试试这个

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?

【讨论】:

  • 不是我理想的解决方案,因为它感觉像是一个黑客,但我现在会继续使用它
  • 你能给我你的邮件ID吗
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-08-29
  • 1970-01-01
  • 1970-01-01
  • 2013-07-29
  • 2023-03-11
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多