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?
Asked
Active
Viewed 109 times
0
-
In new API 22 text is default capital.Can you tell which style and API you are using? – Shvet Jun 15 '15 at 08:22
-
Is there any way to decapitalize text? – The Dark Knight Jun 15 '15 at 08:23
-
yes. you can change it from style. – Shvet Jun 15 '15 at 08:23
-
possible duplicate of [How to capitalize a the first letter of text in a TextView in an Android Application](http://stackoverflow.com/questions/3419521/how-to-capitalize-a-the-first-letter-of-text-in-a-textview-in-an-android-applica) – UeliDeSchwert Jun 15 '15 at 08:24
2 Answers
2
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" />

Strider
- 4,452
- 3
- 24
- 35
0
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.

Shvet
- 1,159
- 1
- 18
- 30