如何改变TextInputLayout的浮动标签颜色 [英] How to change the floating label color of TextInputLayout

查看:880
本文介绍了如何改变TextInputLayout的浮动标签颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

参照由谷歌发布了全新的TextInputLayout,我该如何改变浮动标签文本颜色?

With reference to the new TextInputLayout released by Google, how do I change the floating label text color?

在风格设定colorControlNormal,colorControlActivated,colorControlHighLight于事无补。

Setting colorControlNormal, colorControlActivated, colorControlHighLight in styles does not help.

这是我现在有:

推荐答案

找到了答案,用android.support.design:hintTextAppearance属性来设置自己的浮动标签的外观。

Found the answer, use android.support.design:hintTextAppearance attribute to set your own floating label appearance.

例如:

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    app:hintTextAppearance="@style/TextAppearance.AppCompat">

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

这篇关于如何改变TextInputLayout的浮动标签颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆