如何更改 searchView 提示文本颜色?
提示文本颜色为白色,因此不可见。我想改变颜色,但不知道怎么做。 This is the searchView Photo
这是 XML 代码:
<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" />
最佳答案
<item name="android:textColorHint">@android:color/yourColor</item>
将上述代码添加到您的父主题(styles.xml 中的应用程序主题)。 这会起作用:)
关于android - 更改searchView提示文本颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67805317/