Why Is My Button Text Forced to All Caps on Lollipop

Why is my Button text forced to ALL CAPS on Lollipop?

This is fixable in the application code by setting the button's TransformationMethod, e.g.

mButton.setTransformationMethod(null);

Lollipop capitalizes Buttons' text in my app

Starting with Android 5.0, Buttons automatically have their text capitalized. This is in accordance with the new material design guidelines, which you can find here.

If you want to force your buttons to display the text as it does in previous platform versions, you can set android:textAllCaps="false" in your XML. However, I would recommend against this. Users expect their apps to look material in Android Lollipop, and that means they expect your buttons to display text in all capital letters (even if your app displays the text differently in previous platform versions).

Button text always showing in uppercase

I'm guessing you see this on Android as it is the default for button text and has been since Lollipop.

To change this behavior add the following to your styles.xml file which can be found in the Android project under the Resources then values folders

<item name="android:textAllCaps">false</item>

Cannot lower case button text in android studio

You could add android:textAllCaps="false" to the button.

The button text might be transformed to uppercase by your app's theme that applies to all buttons. Check themes / styles files for setting the attribute android:textAllCaps.

How to capitalize button text pre-Lollipop?

You only need to create a custom style for your button

<style name="CustomButton">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_centerVertical">true</item>
<item name="android:textAllCaps">true</item>
</style>

Then set it to your button like:

<Button 
android:id="@+id/total_bill"
style="@style/CustomButton" />

Or you can do something like:

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

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

The second method will change it for all Button across the application.One another way is to extend the Button and create a custom Button where textcaps is set to true and use that Button instead of default one.

Text button text all caps for older api 8

try this in your Activity

mButton.setTransformationMethod(null);



Related Topics



Leave a reply



Submit