android代码设置某个TextInputLayout禁用hintcolor颜色
简书链接:android代码设置某个TextInputLayout禁用hintcolor颜色
文章字数:169,阅读全文大约需要1分钟
直接这样设置会发现没效果 textInputLayout.setHintTextColor(colorStateList);
因此用setDefaultHintTextColor
1 | public static void setTextInputLayoutHintColor(TextInputLayout textInputLayout, ColorStateList colorStateList) { |
生成ColorStateList
1 | public static ColorStateList getColorStateList(int pressColor, int focusedColor, int disableColor, int normalColor) { |
或者
1 | ColorStateList.valueOf(ContextCompat.getColor(context,R.color.your_color_name)) |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 情迁博客!
评论