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

This is how I set my buttons.

<Button
    android:id="@+id/button_login"
    style="@style/ButtonStyle"
    android:text="@string/button_login" />

This is my style on values folder.

  • What does 'unique visitor' mean in the context of Google Analytics on Android?
  • how to merge to two bitmap one over another
  • Using of getSpectrum() in Libgdx library
  • MapView adding pushpins on touch
  • No resource found that matches the given name 'android:Theme.Holo.Light'
  • SearchView is null android
  • <style name="ButtonStyle" parent="ButtonStyleBase" />
    
    <style name="ButtonStyleBase">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_marginTop">@dimen/padding</item>
        <item name="android:textSize">@dimen/font_regular</item>
        <item name="android:textColor">@color/text_regular</item>
        <item name="android:background">@drawable/shape_clickable</item>
    </style>
    

    And this is my style on values-v21 folder

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

    But the text is always uppercase on buttons. If I set it directly on the button it will get back to normal, though. I changed the color to see if the style for api 21 was being used and it was, the button text color changed to black on api 21. I know the default theme sets textAllCaps as true for buttons because google thought it would be super-duper-cool, but shouldn’t it prioritize my style?

    Edit: neverming, I forgot to write “android:” on the style.

    Related posts:

    Saving ArrayList in SQLite database in Android
    Android: How to get background color of Activity in Java?
    Call .NET web service in Android
    How to stop video playing in VideoView programmatically in android?
    scrollBar in a listView&hellip;customizing it.
    Flash in an Android WebView - layering issue
  • Extending ArrayAdapter in android
  • When does ADT set BuildConfig.DEBUG to false?
  • How to change widget layout background programatically
  • How to set the custom size of the stars in RatingBar
  • Default FirebaseApp is not initialized
  • error openning HPROF file
  • 4 Solutions collect form web for “Can't override textAllCaps for buttons on style under android 21”

    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.

    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

    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.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.