janki janki - 1 year ago 223
Android Question

Change color android.support.v7.widget.SearchView

i am using search view.

<android.support.v7.widget.SearchView
android:id="@+id/searchView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/imageViewMenu"

>



Is this possible to change text color and icon color to view?

currantly it shows black text and icon. want to change white color text and white search icon.

Answer Source

This may work..

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));