Android colorControlNormal xml attributes doesn't work pre-Lollipop

孤者浪人 提交于 2019-12-04 01:12:46

You have to set the colorControlActivated, colorControlHighlight and colorControlNormal in your app theme (or activity theme) not in your edittext style.

Something like this:

<style name="Theme.App.Base" parent="Theme.AppCompat.Light">
    <item name="colorControlNormal">@color/middle_sqool_primary</item>
    <item name="colorControlActivated">@color/middle_sqool_primary</item>
    <item name="colorControlHighlight">@color/middle_sqool_primary</item>
</style>

As a workaround, try using android.support.v7.widget.AppCompatEditText rather than EditText. You should always use that for programmatically created views.

Pretty sure you made it, but be sure you are editing themes in the values folder and not in the values-v21 one (if any).

I had a similar issue. Wanted to change the highlight colour of the menu items. And none of these attributes didn't work (Support Library v25.0.0).

The only attribute that allowed me to change colour on Pre-L devices is this:

<item name="actionBarItemBackground">@drawable/YOUR_DRAWABLE</item>

I stopped searching for further workarounds because it's obvious that Support Library is NOT ready for production code.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!