How to change the color of the icon, the hint and the text in a toolbar search view?

  android, android-theme, android-xml, colors, searchview

This is my theme:

<style name="Theme.Cinemates" parent="Theme.AppCompat.NoActionBar">
    <item name="colorPrimary">@color/yellow</item>
    <item name="colorPrimaryVariant">@color/black</item>
    <item name="colorOnPrimarySurface">@color/black</item>
    
    <item name="colorSecondary">@color/teal_200</item>
    <item name="colorSecondaryVariant">@color/teal_700</item>
    <item name="colorOnSecondary">@color/black</item>
    
    <item name="android:textColor">@color/black</item>
    <item name="editTextColor">@color/black</item>
    <item name="hintTextColor">@color/black</item>
    <item name="iconTint">@color/black</item>
    <item name="android:actionMenuTextColor">@color/black</item>
</style>

This is my toolbar:

<androidx.appcompat.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:logo="@drawable/clapboard"
    app:titleTextColor="@color/black"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:titleMarginStart="35dp"/>

This is my menu:

<?xml version="1.0" encoding="utf-8"?>
<menu
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <item
        android:id="@+id/ricerca_film"
        android:title="Search"
        android:icon="@drawable/ic_navbar_search"
        android:iconTint="@color/black"
        app:showAsAction="always"
        app:actionViewClass="android.widget.SearchView" />

</menu>

The search view icon, the hint and the text appear white no matter what I try. What do I need to change? I can provide more info if needed.

Source: Android Questions

LEAVE A COMMENT