Disable All Caps in Android Button

Android button text may appear in uppercase because the applied theme or button style transforms the label to all capital letters. You can disable this transformation in the XML layout or in Kotlin code.

In this Android Tutorial, we shall learn how to preserve the capitalization written in the button’s android:text value.

Disable Android Button All Caps in XML

Add android:textAllCaps="false" to the Button element. Android will then display the label using the same uppercase and lowercase letters supplied in android:text.

</>
Copy
<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Save Changes"
    android:textAllCaps="false" />

Disable Android Button All Caps Programmatically in Kotlin

To change the setting at runtime, set the button’s isAllCaps property to false.

</>
Copy
button.isAllCaps = false
Diable All Caps in Android Button

Android Button All Caps Example

Create an Android Project and replace activity_main.xml layout file and MainActivity.kt file with the following code.

The example contains three buttons. The first uses the default style, the second disables all caps in XML, and the third disables all caps from Kotlin.

activity_main.xml

</>
Copy
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:gravity="center"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <Button
        android:id="@+id/btn0"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="All Caps - Default Way" />
    <Button
        android:id="@+id/btn1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAllCaps="false"
        android:text="All Caps Off - XML Way" />
    <Button
        android:id="@+id/btn2"
        android:text="All Caps Off Programmatically"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />


</LinearLayout>

MainActivity.kt

</>
Copy
package com.tutorialkart.disableallcapsinbutton

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        btn2.isAllCaps = false
    }
}

Using View Binding in a Current Android Project

The original example uses Kotlin Android Extensions synthetic view access, which is no longer used in current Android projects. With View Binding enabled, you can access the button through the generated binding class and apply the same isAllCaps property.

</>
Copy
private lateinit var binding: ActivityMainBinding

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    binding = ActivityMainBinding.inflate(layoutInflater)
    setContentView(binding.root)

    binding.btn2.isAllCaps = false
}

Button Text All Caps and Keyboard Auto-Capitalization Are Different

The textAllCaps and isAllCaps settings affect how text is displayed inside a button. They do not change capitalization behavior in an on-screen keyboard or an EditText field.

If typed text is being capitalized automatically, review the input field’s inputType, Compose keyboard options, or the user’s keyboard settings. That is a separate issue from uppercase button labels.

When Android Button Text Still Appears in Uppercase

  • Confirm that android:textAllCaps="false" is applied to the same button shown on screen.
  • Check whether a style or theme sets textAllCaps again.
  • Check for Kotlin or Java code that later assigns isAllCaps = true.
  • Verify that the displayed text is not already written in uppercase in a string resource.
  • Rebuild the app after changing theme or style resources.

Frequently Asked Questions About Android Button Capitalization

How do I turn off all caps for an Android Button in XML?

Add android:textAllCaps="false" to the Button element in the layout XML.

How do I disable all caps for a Button in Kotlin?

Get a reference to the button and set button.isAllCaps = false.

Why does Android display my button label in uppercase?

A theme or button style may apply an all-caps text transformation. The original string itself does not necessarily contain uppercase letters.

Does textAllCaps change the text stored in the string resource?

No. It controls the displayed transformation of the button label. It does not rewrite the underlying string resource.

Does isAllCaps disable automatic capitalization on the Android keyboard?

No. isAllCaps applies to the view’s displayed text. Keyboard auto-capitalization is controlled separately by input and keyboard settings.

Android Button All Caps Editorial QA Checklist

  • The XML solution uses android:textAllCaps="false" on a Button.
  • The Kotlin solution uses isAllCaps = false.
  • The tutorial distinguishes button text transformation from keyboard auto-capitalization.
  • The original XML and Kotlin example blocks remain unchanged.
  • Current projects are directed to View Binding instead of synthetic view access.

Conclusion

In this Kotlin Android Tutorial, we learned how to disable all caps for text in an Android Button using XML and Kotlin. Use android:textAllCaps="false" in a layout or set isAllCaps to false in code.