Android colorControlNormal xml attributes doesn't work pre-Lollipop

前端 未结 3 1689
旧时难觅i
旧时难觅i 2021-02-19 18:33

I\'ve been trying to change the color of the EditText line on the bottom, but my EditText still doesn\'t wanna change the color, but it\'s using the st

相关标签:
3条回答
  • 2021-02-19 19:25

    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.

    0 讨论(0)
  • 2021-02-19 19:29

    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).

    0 讨论(0)
  • 2021-02-19 19:36

    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>
    
    0 讨论(0)
提交回复
热议问题