Can't override textAllCaps for buttons on style under android 21

六眼飞鱼酱① 提交于 2019-12-04 03:01:04

I had the same issue and this is what worked for me:

<style name="Theme.CustomTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
    <item name="android:textAppearanceButton">@style/CustomTheme.ButtonTextAppearance</item>
</style>

<style name="CustomTheme.ButtonTextAppearance" parent="@style/Base.TextAppearance.AppCompat.Button">
    <item name="textAllCaps">false</item>
    <item name="android:textAllCaps">false</item>
</style>

Hope this helps.

In styles.xml

Include the button style in your AppTheme(Which will be using in Application or Activity)

    <style name="AppTheme" parent="@style/Theme.AppCompat.Light">
<item name="android:buttonStyle">@style/MyButton</item>    
</style>

create button style

<style name="MyButton" parent="Widget.AppCompat.Button">
        <item name="textAllCaps">false</item>
        <item name="android:textAllCaps">false</item>
    </style>

If you found any issue please let me know.

Make sure that the following line does not say "android:" before "textAllCaps"

<item name="textAllCaps" tools:targetApi="ice_cream_sandwich">false</item>

Your style on values-v21 folder its correct

<style name="ButtonStyle" parent="ButtonStyleBase">
    <item name="textAllCaps">false</item>
    <item name="android:textColor">#000000</item>
</style>

but same time Api level above 21 your style paste on values-v19 and also style folder xml

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