Android Button – Disable All Uppercase Text

Android Button – Disable All Uppercase Text

To disable all uppercase for text in Button widget, set the android:textAllCaps attribute with “false”.

Example

Create an Android Application with Kotlin support and Empty Activity. Create a Button widget with android:textAllCaps attribute set to false.

activity_main.xml

<?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:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:gravity="center"
    tools:context=".MainActivity">

    <Button
        android:id="@+id/myButton"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_gravity="center"
        android:layout_margin="20sp"
        android:paddingHorizontal="40sp"
        android:textAllCaps="false"
        android:background="#FFF"
        android:textSize="25sp"
        android:textColor="#29F"
        android:text="@string/submit" />

</LinearLayout>

MainActivity.kt

package com.kotlinandroid.myapp

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle

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

Screenshot