how to change background color of button in Kotlin?

Viewed 34

I recently started android and I am creating a simple login screen without any function. I created a new xml file to change the corners and background color. Changing corners do work but color does not. I also added extra color which I want to fill into the colors.xml file in values, but it does not work. I would like to know what I did wrong, or what I missed. here is the xml file named bin_yellow.

    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android">
        <solid android:color="@color/KakaoYellow"/>
        <corners android:radius="20dp"/>
    </shape>

and here is the activity.xml file.

 <Button
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:background = "@drawable/bin_yellow"
    android:textColor="@color/black"
    android:text = "Log in with Kakao"
    >
</Button>
1 Answers

android:background = "@drawable/bin_yellow" delete and replace it android:backgroundTint = "@drawable/bin_yellow"

Related