android - TextInputLayout HelperText 激活时不改变颜色
问题描述
我有一个具有以下主题的 TextInputLayout:
<style name="TextInputLayoutTheme" parent="Widget.Design.TextInputLayout">
<item name="colorControlNormal">@color/grey</item>
<item name="colorControlActivated">@color/blue</item>
</style>
和 helperTextTextAppearance:
<style name="TextInputLayoutHelperText" parent="TextAppearance.Design.HelperText">
<item name="android:textColor">@color/helper_text_color</item>
</style>
和 helper_text_color xml:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/blue" android:state_focused="true" />
<item android:color="@color/grey" android:state_focused="false" />
</selector>
对于 EditText 和提示文本,这很好用:当我点击 TIL 并聚焦时,它是灰色的并变成蓝色。
但是 helperText 一直保持灰色 - 我希望它也变为蓝色。
我也尝试将其更改为,<item android:color="@color/blue" android:state_activated="true" />
但它也不起作用。
我需要如何定义helperTextTextAppearance
以确保它根据 改变它的颜色colorControlActivated
?
解决方案
推荐阅读
- character - 为什么 rand() 函数即使在使用种子时也会通过多次调用打印出相同的值
- python - 如何将所有 csv 文件合并为一个文件并将数据堆叠在原始标题下?
- javascript - 如果您进行更多处理,为什么以下算法之一比另一种更快?
- javascript - 回调函数返回整个对象而不是值
- r - 如何在 selectInput() 中使用具有多个级别的因子变量以在 flexdashboard 中发光
- python - 如何使用python计算嵌套列表中字符串的0并打印其索引
- python - 我试图在 python 中创建一个函数,但是在创建该函数时它给了我一个语法错误,我找不到那个错误在哪里
- flutter - 参数类型“动态”不能分配给参数类型“映射”
' 来自 Lint vs Pedantic - c - 查找数组中的最小值
- javascript - 在 Fullcalendar V5 上使用 Ajax 从数据库中获取事件后未显示事件