Button text font style changed for AppCompatActivity

After changing the parent element for my activity from Activityto AppCompatActivity, the font on the buttons has changed. For example, RemoveRemove. For others, the Vewsfont has not changed.

Why has the font on the buttons changed and how to return the original font?

Button

            <Button
            android:id="@+id/buttonAddProduct"
            tools:text="Remove"
            android:layout_width="match_parent"
            android:textSize="13dp"
            android:layout_weight="1"
            style="@style/btns_blue_big" />

style:

<style name="btns_text_big">
    <item name="android:textSize">@dimen/text_size_big</item>
    <item name="android:textColor">@color/colorMainWhite</item>
</style>

<style name="btns_lo_big" parent="btns_text_big">
    <item name="android:layout_width">fill_parent</item>
    <item name="android:layout_height">48dp</item>
</style>

<style name="btns_blue_big" parent="btns_lo_big">
    <item name="android:background">@drawable/button_dialog_positive_shape</item>
</style>
+4
source share
3 answers

The change is due to the Google Material Design theme.

Basically, when you change Activityto AppCompatActivity, you also need to change the theme of your application in order to switch from Theme.AppCompat. This change makes the design for each presentation fit the theme.

The following is an example between a theme Holoand a theme AppCompat:

Holo Theme

Material Theme / AppCompat

, AppCompat , .

xml:

<style name="MyAppTheme" parent="Theme.AppCompat">
    <item name="buttonStyle">@style/MyAppTheme.Button</item>
    <item name="android:buttonStyle">@style/MyAppTheme.Button</item>
</style>

<style name="MyAppTheme.Button" parent="Base.Widget.AppCompat.Button">
    <item name="android:textAllCaps">false</item>
</style>
+5

AppcompatActivity " ". . xml, android:textAllCaps="false"

: button.setTransformationMethod(null);

+1

- Material ( DeviceDefault with API 21+). . ,

<item name="android:textAllCaps">false</item>
<item name="textAllCaps">false</item>

CAPS Lollipop?

+1

Source: https://habr.com/ru/post/1691171/


All Articles