I want to change the color of a text in an ActionBarSherlock SearchView
, so I found this on StackOverflow:
AutoCompleteTextView searchText = (Au
Change and apply your styles as follows:
Overwrite SearchViewStyle
that defines relevant style.
<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>
Apply this theme in your Manifest (android:theme="CustomTheme"
).
Hope this helps ... Cheers!
p.s. search for SearchViewStyle
in ABS style definitions (XML files). This way you can follow up available styles using Ctrl+click on definitions.
other way, work for me
@Override
public boolean onCreateOptionsMenu(Menu menu) {
searchView = new SearchView(getSupportActionBar().getThemedContext());
AutoCompleteTextView searchText = (AutoCompleteTextView) searchView.findViewById(R.id.abs__search_src_text);
searchText.setTextColor(Color.BLACK);
.....................
}