搜索查看的文本颜色的动作条与ActionBarSherlock文本、颜色、动作、ActionBarSherlock

由网友(Superman°)分享简介:我要改变文本的颜色在ActionBarSherlock 搜索查看,所以我发现这对计算器:I want to change the color of a text in an ActionBarSherlock SearchView, so I found this on StackOverflow:AutoComp...

我要改变文本的颜色在ActionBarSherlock 搜索查看,所以我发现这对计算器:

I want to change the color of a text in an ActionBarSherlock SearchView, so I found this on StackOverflow:

AutoCompleteTextView searchText = (AutoCompleteTextView) searchView.findViewById(R.id.abs__search_src_text);
searchText.setHintTextColor(getResources().getColor(R.color.white));
searchText.setTextColor(getResources().getColor(R.color.white));    

但问题是, searchText 始终为空。我也试图与 search_src_text (没有 ABS __ ) - 再次, searchText

But the problem is that searchText is null always. Also I tried with search_src_text (no abs__) - again, searchText is null.

我用夏洛克我的动作条(具有用于动作条自定义视图),但我也想改变搜索视图的文本颜色。

I use Sherlock for my ActionBar (having custom view for the actionbar) but I also want the text color of the search view to be changed.

什么我不明白?

推荐答案

修改并应用样式如下:

覆盖 SearchViewStyle 定义相关的风格。

<style name="SearchViewStyle" 
       parent="Widget.Sherlock.Light.SearchAutoCompleteTextView">
    <item name="android:textColor">myTextColor</item>
</style>

将此样式定义您的应用程序的主题。

Add this style definition to your app theme.

<style name="CustomTheme" parent="Theme.Sherlock.Light">
    ...
    <item name="searchAutoCompleteTextView">@style/SearchViewStyle</item>
    ...
</style>

excel对于不同的信息用不同的文本颜色表示出来

在你的清单应用这个主题。(安卓主题=CustomTheme

希望这有助于...干杯!

Hope this helps ... Cheers!

PS 的搜索 SearchViewStyle 在ABS的样式定义(XML文件)。这样,您就可以使用Ctrl +单击定义跟进可用的样式。

p.s. search for SearchViewStyle in ABS style definitions (XML files). This way you can follow up available styles using Ctrl+click on definitions.

阅读全文

相关推荐

最新文章