【问题标题】:Changing searchView hint text Color [duplicate]更改 searchView 提示文本颜色 [重复]
【发布时间】:2021-08-20 14:58:45
【问题描述】:

如何更改 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" />

【问题讨论】:

    标签: android android-studio android-actionbar searchview


    【解决方案1】:
    <item name="android:textColorHint">@android:color/yourColor</item>
    

    将上述代码添加到您的父主题(styles.xml 中的应用主题)。 这将起作用:)

    【讨论】:

      猜你喜欢
      • 2013-08-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-24
      • 2016-09-06
      • 1970-01-01
      • 2016-01-22
      相关资源
      最近更新 更多