android - TextInputLayout 提示颜色

标签 android android-edittext android-design-library

我正在使用新的 Google 设计库 (com.android.support:design:22.2.0),但我遇到了 android.support.design.widget.TextInputLayout 的问题。

如果我以编程方式设置它的 EditText, float 提示颜色是灰色而不是强调色。如果用户自己填写字段 (EditText) 或更改字段的预定义值,它会起作用。

这是我的代码:

<android.support.design.widget.TextInputLayout
        android:layout_height="wrap_content"
        android:layout_width="match_parent">
        <EditText
            android:id="@+id/register_username"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/register_username"
            android:inputType="text"/>
</android.support.design.widget.TextInputLayout>

用户点击某个按钮后,它通过 EditText 的 setText() 方法填充字段, float 提示变为灰色。是错误还是我遗漏了什么?

最佳答案

android:textColorHint="@color/your_color" 放入 TextInputLayout

关于android - TextInputLayout 提示颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30589895/

相关文章:

android - 警报管理器触发通知

android - 如何在 NestedScrollView 中使用 RecyclerView

android - 创建上面有 textview 的 imageview 图像

android - 如何使用设计库选项卡布局更改工具栏标题?

android - params.getBehaviour() 返回空值

android - 获取异常 : java. lang.NoClassDefFoundError : android. support.v7.app.AppCompatDelegateImplV14

android - 每次修改apk都要resign吗?

安卓 SQLite 错误 "requesting column name with table name"

android - EditText 不会在平板电脑上提取

android - EditText 未收到 TAB 键事件 - stock soft vk