Кто-нибудь знает, как изменить цвет текста appcoppat SearchView? Я потратил 2 часа и попробовал несколько предложений от SO, и никто не работает.
Вот мой код:
<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>
И в моей деятельности у меня есть следующее:
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);
}