【问题标题】:Resource linking failed when setting app:textColorHint for TextInputLayout of Material Design为 Material Design 的 TextInputLayout 设置 app:textColorHint 时资源链接失败
【发布时间】:2020-08-14 11:05:27
【问题描述】:

我正在为我的TextInputLayout 创建一个样式,如下所示:

    <style name="AppTheme.TextInputLayout.FilledBox" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
        <item name="android:textColorHint">@color/white</item>
        <item name="textColorHint">@color/white</item> //This line is not getting recognized. 
    </style>

根据documentation

android:textColorHint 是提示颜色。

app:hintTextColor 是折叠(浮动)提示颜色。

问题仅发生在 styles 上。如果我将app:hintTextColor 直接设置为TextInputLayout,一切正常。

我正在使用材料设计:

    implementation 'com.google.android.material:material:1.2.0-alpha06'

我也在黑貂版1.1.0 上对其进行了测试。不过,同样的问题正在发生。

【问题讨论】:

    标签: android material-design android-textinputlayout material-components-android material-components


    【解决方案1】:

    按照你的风格改变项目:

    <item name="textColorHint">@color/white</item>
    

    <item name="hintTextColor">@color/white</item>
    

    类似:

    <style name="MyFilledBox" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
        <item name="hintTextColor">@color/...</item>
        <item name="android:textColorHint">@color/....</item>
    </style>
    

    【讨论】:

    • 谢谢加布里埃尔!我在那里输入错误真是太遗憾了:)
    猜你喜欢
    • 2019-12-11
    • 2018-11-23
    • 1970-01-01
    • 1970-01-01
    • 2019-02-01
    • 2022-07-07
    • 1970-01-01
    • 2019-03-09
    • 1970-01-01
    相关资源
    最近更新 更多