java - 如何在 Android Studio 中更改提示文本颜色?

标签 java android xml layout

我无法在登录页面的 Android 应用程序中更改提示文本颜色。

<AutoCompleteTextView
                android:id="@+id/email"
                android:textColor="@color/white"
                android:backgroundTint="@android:color/white"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/prompt_email"
                android:textColorHint="@android:color/white"
                android:inputType="textEmailAddress"
                android:maxLines="1" />

我使用了在许多其他在线示例中找到的 textColorHint 方法,但我不知道我正在做的事情有什么问题。

最佳答案

使用属性android:textColorHint="YOUR_COLOR"设置提示文本颜色。

在您的 AutoCompleteTextView 中,您对 textColorbackgroundTinttextColorHint< 使用 WHITE 颜色。确保您的 AutoCompleteTextView 背景颜色与 WHITE 不同。

这是一个AutoCompleteTextView的工作示例。我使用了 RED 颜色作为 textColorGREEN 颜色 backgroundTintBLUE 颜色textColorHint

<AutoCompleteTextView
    android:id="@+id/email"
    android:textColor="#FF0000"
    android:backgroundTint="#00FF00"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="Write something..."
    android:textColorHint="#0000FF"
    android:inputType="textEmailAddress"
    android:maxLines="1" />

输出

enter image description here

希望对你有帮助~

关于java - 如何在 Android Studio 中更改提示文本颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43217751/

相关文章:

java - 将 Java applet 置于联机状态 (netbeans)

java - x4j-分析和带有图表的多页 Excel 报告

java - 仅显示一次对话框

javascript - 意外的标识符错误

.net 将 xml 反序列化为多个已知对象之一

java - 如何映射具有双向关系的三元日期映射?

java - 想要为 setBackgroundColor() 方法设置多种颜色

android - 如何在扩展 AsyncTask 的类中将对象更改为字符串?

android - 将 json 对象发送到服务器的问题

c# - 读取多个 XML 属性