how to change font weight of material button in android?

160 views Asked by At

I want to change the fornt weight of text in material button? here is my code

Button Code:

    <com.google.android.material.button.MaterialButton
        style="@style/my_style"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="16dp"
        android:text="Check Permission"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:shapeAppearanceOverlay="@style/my_style" />

Style Code:

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <style name="my_style">
        <item name="cornerFamilyTopRight">rounded</item>
        <item name="cornerFamilyBottomRight">rounded</item>
        <item name="cornerFamilyTopLeft">cut</item>
        <item name="cornerFamilyBottomLeft">cut</item>
        <item name="cornerSize">12dp</item>
        <item name="backgroundTint">@color/black</item>
        <item name="android:textAppearance">@style/font</item>
    </style>
    <style name="font_style">
        <item name="fontWeight">400</item>
        <item name="fontFamily">
            cursive
        </item>
        <item name="android:textSize">24sp</item>
    </style>
</resources>

i've tried changing the font weight from 400 to other in font_style but it is not working, I dont want to use bold italic etc.

0

There are 0 answers