0

I'm trying to set the text color of the SearchViews of my app to white. I've added to my app's main theme "searchViewStyle" to define the style of every one.

<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="searchViewStyle">@style/CustomSearchView</item>
</style>

Then I created the "CustomSearchView" style, in the same file.

<style name="CustomSearchView" parent="android:Theme.Holo">
    <item name="searchIcon">@drawable/ic_small_search</item>
    <item name="fontFamily">@font/roboto</item>
    <item name="queryBackground">@null</item>
    <item name="searchHintIcon">@null</item>
    <item name="editTextColor">@color/colorWhite</item>
    <item name="android:textColor">@color/colorWhite</item>
    <item name="hintTextColor">@color/colorWhite</item>
</style>

And this is what I have in the menu item:

<menu 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <item
        android:id="@+id/appbarSearch"
        android:title="@string/buscar"
        android:icon="@drawable/ic_small_search"
        app:showAsAction="ifRoom|collapseActionView"
        app:actionViewClass="androidx.appcompat.widget.SearchView"
        />

</menu>

As you can see, I've tried with "editTextColor", "textColor" and "hintTextColor", but none of those options have actually worked. ¿So what else can I do to customize the color?

HB.
  • 4,116
  • 4
  • 29
  • 53
TheAsdas
  • 11
  • 4

0 Answers0