2

How can I change the searchView hint text color?

The hint text color is white, so it's invisible. I want to change the color but I don't know how. This is the searchView Photo

And this is the XML code:

<androidx.cardview.widget.CardView
                android:id="@+id/search_input"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="14dp"
                android:layout_marginEnd="14dp"
                android:layout_marginTop="10dp"
                app:cardElevation="3dp"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toTopOf="parent">

                <androidx.appcompat.widget.SearchView
                    android:id="@+id/search"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:focusable="true"
                    app:queryBackground="@null"
                    app:queryHint="@string/find_username"
                    app:iconifiedByDefault="false"
                    app:showDividers="end"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

1 Answers1

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

add the above code to your parent theme (App Theme in styles.xml). This will work :)

dennisrufigill
  • 379
  • 1
  • 3
  • 14