I am trying to apply background style on button for that I created a drawable resource file but its unable to take its effect.Its only showing white button only Below is my code:
log_out.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@color/accent"/> <corners android:radius="10dp"/> </shape>
activity_main.xml
<Button android:layout_width="match_parent" android:layout_height="50dp" android:text="LOGOUT" android:background="@drawable/log_out"/>
Someone please let me know how can I achieve desired layout.Any help would be appreciated.
THANKS
It is due to the application theme. This structure will not work if you are using a Material Design theme.
If you change the main theme with parent = "Theme.AppCompat.DayNight" as an example, it will work.
parent = "Theme.AppCompat.DayNight"
1.4m articles
1.4m replys
5 comments
56.9k users