Is it possible to change the textcolor on an Android SearchView? Is it possible to change the textcolor on an Android SearchView? android android

Is it possible to change the textcolor on an Android SearchView?


Add

<item name="android:editTextColor">@android:color/white</item>

to the parent theme and that should change the entered text. You can also use

<item name="android:textColorHint">@android:color/white</item>

to change the hint text color for the SearchView. (Note that you can replace the @android:color/white with whatever appropriate value you're hoping to use)


Try something like this :You would get a handle to the textview from the sdk and then change it since they don't expose it publicly.

int id = searchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null);TextView textView = (TextView) searchView.findViewById(id);textView.setTextColor(Color.WHITE);


This works for me.

SearchView searchView = (SearchView) findViewById(R.id.search);EditText searchEditText = (EditText) searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text);searchEditText.setTextColor(getResources().getColor(R.color.white));searchEditText.setHintTextColor(getResources().getColor(R.color.white));