When creating a button (button), whatever text is transferred to it, it is shown in capital letters. The most ordinary code. Here is the beginning in xml:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" > <LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="+" android:id="@+id/kn" android:onClick="onClick_kn"> </Button> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="в архив" android:id="@+id/archive" android:onClick="to_archive" /> 

This happens with all buttons in any Window, regardless of whether or not the style is applied to the buttons. The manifest has a theme: android: theme = "@ style / AppTheme". If you remove it, nothing changes.

    2 answers 2

    For all buttons in the project, you can:

    1. change style:

       <style name="AppTheme" parent="Theme.AppCompat"> <item name="buttonStyle">@style/NotCapsButton</item> </style> <style name="NotCapsButton" parent="Widget.AppCompat.Button"> <item name="android:textAllCaps">false</item> </style> 
    2. use your class (for buttons not from AppCompat use the setAllCaps() method:

       public class NotCapsButton extends AppCompatButton { public Button(Context context, AttributeSet attrs) { super(context, attrs); setSupportAllCaps(false); } public Button(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); setSupportAllCaps(false); } } 

    For a single button:

    1. Specify the textAllCaps parameter in the xml attributes:

       <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" android:textAllCaps="false" /> 
    2. Programmatically set in the code:

       mButton.setSupportAllCaps(false); // для кнопок AppCompat mButton.setAllCaps(false); // для кнопок не AppCompat 

      or

       mButton.setTransformationMethod(null); 
    • Sumptuously!!!! - St-St

    So the buttons are arranged. Just use TextView instead.

    • Thank you. When I look at other examples, there is a different text behavior: ( habrahabr.ru/post/206012 ) I would like to resolve the issue using the button, since I apply the property to it that allows to insert an icon to the left of the text: android:drawableLeft="@drawable/ic_play_arrow_white_48dp" and its background with the effect of a diverging wave from the transition of one color to another when pressed. Is it possible to solve the issue using the button? - St-St
    • All this is also done for TextView . And, perhaps, it is easier to customize it than a button. - Yuriy SPb
    • And in different versions of the android buttons (and much more) behave differently. If you do not want to envy from this - use the proposed option. - YurySPb