C
C
Chesterfield252021-10-03 01:51:55
XML
Chesterfield25, 2021-10-03 01:51:55

Why isn't the background applied to the button?

Why can't I apply a background to a button? It just doesn't apply the background I want.
6158e2518c27a774106580.png

Button Code

<Button
                android:id="@+id/loginBtn"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:layout_marginTop="10dp"
                android:layout_marginRight="10dp"
                android:background="@drawable/button_2"
                android:text="Already have an account?"
                android:textColor="@color/colorWhite" />

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
Chesterfield25, 2021-10-03
@Chesterfield25

Found two solutions. You need to change the theme Theme.MaterialComponentsto Theme.AppCompator instead of the usual use I used the second option! <Button><android.widget.Button>

A
Araya, 2021-10-03
@Araya

For button useandroid:backgroundTint

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question