Android
Android Studio
Button Text
Lowercase
UI Design

Cannot lower case button text in android studio

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

If your Android button text keeps appearing in uppercase, the usual cause is not your string resource. It is the button style applying an “all caps” transformation, which comes from AppCompat or Material styling rather than from the text value itself.

Disable the All-Caps Transformation in XML

The first fix to try is the textAllCaps attribute:

xml
1<Button
2    android:id="@+id/loginButton"
3    android:layout_width="wrap_content"
4    android:layout_height="wrap_content"
5    android:text="Sign in"
6    android:textAllCaps="false" />

If you are using AppCompatButton or MaterialButton, this is still the right idea. Depending on the widget and theme, you may also see the non-namespaced form in styles:

xml
<style name="AppButton" parent="Widget.MaterialComponents.Button">
    <item name="textAllCaps">false</item>
</style>

Then apply the style to the button:

xml
1<com.google.android.material.button.MaterialButton
2    android:layout_width="wrap_content"
3    android:layout_height="wrap_content"
4    android:text="Sign in"
5    style="@style/AppButton" />

This is usually the cleanest solution because it fixes the behavior at the view or theme level.

You Can Also Disable It in Code

If the view is created dynamically or you need to override styling at runtime:

kotlin
val button = findViewById<Button>(R.id.loginButton)
button.isAllCaps = false
button.text = "Sign in"

That works, but XML or style-based configuration is usually preferable because it keeps the UI definition declarative.

Why the Text Resource Is Not the Real Problem

A common point of confusion is that the string resource already contains lowercase text:

xml
<string name="login_text">Sign in</string>

yet the rendered button still shows SIGN IN. That happens because the transformation is applied after the string is loaded. Changing the resource text alone will not fix it while the all-caps styling remains active.

Watch for Theme-Level Overrides

If setting android:textAllCaps="false" on the button does not work, the theme or widget style may be overriding it. This is common when using Material Components or inherited button styles from the app theme.

In that case, check:

  • the button class you are actually using
  • the style applied directly on the button
  • the app theme’s button style
  • any style overlay coming from a design system

Sometimes the correct fix is not on the individual button at all, but in the shared style definition used across the app.

Design Considerations

All caps became common in older Material design language, but it is not always the best choice. Lowercase or title case often reads better for branded actions, multilingual interfaces, and less aggressive visual tone.

The key is consistency. If one button uses sentence case while the rest of the app uses uppercase labels, the UI can feel accidental rather than intentional.

Common Pitfalls

The biggest mistake is editing the string resource repeatedly while leaving the button style untouched. The uppercase transformation happens after the text is loaded.

Another issue is setting textAllCaps on one button while a theme-level style still overrides the setting. If the direct attribute seems ignored, inspect the applied style chain.

Developers also sometimes mix Button, AppCompatButton, and MaterialButton without noticing that different themes may affect them differently. Confirm which widget class is actually in the layout.

Finally, avoid using runtime code for something that belongs in a style unless the casing really is dynamic. XML is easier to maintain for static UI appearance rules.

Summary

  • Android button text is often uppercased by style, not by the string resource.
  • Use android:textAllCaps="false" or a style item with textAllCaps set to false.
  • 'button.isAllCaps = false works when you need a runtime override.'
  • If the change does not stick, inspect theme and widget style inheritance.
  • Fix casing where the transformation is defined, not where the text string is stored.

Course illustration
Course illustration

All Rights Reserved.