Does anybody know how to change the text color of the appcompat SearchView? I've spent 2 hours and tried several suggestions from SO and none works.
Here is my code:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:espacios="http://schemas.android.com/apk/res-auto" >
<item
android:id="@+id/layer_switcher_button"
android:icon="@drawable/b_categorias"
android:title="@string/menu_layer_switcher_title"
espacios:showAsAction="ifRoom|collapseActionView"/>
<item
android:id="@+id/action_search"
android:icon="@drawable/b_buscar"
android:title="@string/menu_search_title"
espacios:actionViewClass="android.support.v7.widget.SearchView"
espacios:showAsAction="ifRoom|collapseActionView"/>
</menu>
And in my activity I have this:
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
menuItem layerSwitcher = menu.findItem(R.id.layer_switcher_button);
layerSwitcher.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
onLayerSwitcherButtonClicked();
return false;
}
});
MenuItem searchItem = menu.findItem(R.id.action_search);
SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
LinearLayout ll = (LinearLayout) searchView.getChildAt(0);
TextView textView = (TextView) ll.getChildAt(0);
textView.setTextColor(R.color.white);
}