【问题标题】:TextInputLayout label color does not changeTextInputLayout 标签颜色不变
【发布时间】:2019-05-24 13:45:26
【问题描述】:

我正在尝试更改 textInputLayout 标签/提示颜色。我看到它遵循 colorPrimary,所以我应用了一种设置原色的样式,但它不起作用。

我的xml-

<com.google.android.material.textfield.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:hint="hint"
    style="@style/Text"
    >
    <com.google.android.material.textfield.TextInputEditText
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/edittext"/>
</com.google.android.material.textfield.TextInputLayout>

我的风格-

<style name="Text" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
        <item name="android:colorPrimary">@color/white</item>
        <item name="boxStrokeColor">@color/white</item>

我的布局

【问题讨论】:

  • 在您的主要应用主题中设置此颜色:&lt;item name="colorControlActivated"&gt;color you want to set&lt;/item&gt;
  • 还是一样的@JeelVankhede
  • textColorHint 属性添加到TextinputLayout: android:textColorHint="@color/colorAccent"
  • 如果你有空不工作你可以看看吗??

标签: android android-textinputlayout


【解决方案1】:

新的材质库有点混乱。截至目前在com.google.android.material:material:1.1.0-alpha02 textColorHint 不工作但hintTextApperance 工作,它必须是可以定义文本属性的样式。

【讨论】:

    猜你喜欢
    • 2015-08-13
    • 2016-11-14
    • 1970-01-01
    • 2019-04-27
    • 2019-10-11
    • 1970-01-01
    • 2012-08-16
    • 1970-01-01
    相关资源
    最近更新 更多