Decapitalizing text in Android view

114 views Asked by At

I want to insert a text into an Android view, like a button. The problem is that I want the capitalize some specific characters in my text, but Android capitalize all the text I in the text field. For example, I labeled a button with the text "ExaMple" in which I capitalize the characters "e" and "m", then I saw "EXAMPLE" instead. Anyone give me some suggestions?

2

There are 2 answers

0
Strider On BEST ANSWER

add: android:textAllCaps="false" to the style of the button

so change:

<Button
    android:id="@+id/TestButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="ExaMple" />

to:

 <Button
    android:id="@+id/TestButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAllCaps="false"
    android:text="ExaMple" />
0
Shvet On

To decapitalize all text in Project use style.xml.

-->
    <style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="android:textAppearanceButton">@style/CustomTheme.ButtonTextAppearance</item>

        <!--<item name="colorPrimaryDark">@color/ColorPrimaryDark</item>-->
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.





        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>

    <style name="CustomTheme.ButtonTextAppearance" parent="@style/Base.TextAppearance.AppCompat.Button">
        <item name="textAllCaps">false</item>
        <item name="android:textAllCaps">false</item>
    </style>

This is my project style.xml. you need to use only AppTheme part into your style.