Femn Dharamshi
Femn Dharamshi

Reputation: 577

Changing the color of the SearchView in android

So my app has a dark background all over, #272822 And i want to use the SearchView, But the issue with the SearchView is the search icon on it is also dark (almost black) so it is not visible clearly. How can i change the color of this icon and also the color of the text in the SearchView ?

<SearchView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true" />

Upvotes: 0

Views: 61

Answers (1)

mylan atlani
mylan atlani

Reputation: 72

change the searchview by this view and add android:theme with the name of the one below

do this with your search view :

   <android.support.v7.widget.SearchView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        android:layout_marginStart="146dp"
        android:layout_marginTop="173dp"
        android:theme="@style/search"/>

and create style.xml with this in it :

<style name="search" parent="@android:style/Theme.Holo">
    <item name="android:textColorHint">@android:color/white</item>
    <item name="android:editTextColor">@android:color/white</item>
    <item name="android:textColorSecondary">@android:color/white</item>
</style>

i hope this help

Upvotes: 1

Related Questions