CustomEditText AppCombat 着色

CustomEditText AppCombat tinting

我有一个 CustomEditText,因为我想在 CustomView 中应用一种字体。但我也想用新的 Appcombat 样式属性 colorControlNormal 更改下划线的颜色,.... 不幸的是,颜色更改不适用于 CustomEditText。

某些场景不完全支持窗口小部件着色,包括您的场景:

Q: Why is my EditText (or other widget listed above) not being tinted correctly on my pre-Lollipop device?

A: The widget tinting in appcompat works by intercepting any layout inflation and inserting a special tint-aware version of the widget in its place. For most people this will work fine but I can think of a few scenarios where this won’t work including:

  • You have your own custom version of the widget (i.e. you’ve extended EditText)
  • ...

The special tint aware widgets are currently hidden because they’re an unfinished implementation detail.

来源:https://chris.banes.me/2014/10/17/appcompat-v21/#faq