I am new to Android and trying to create a simple app. However, I cannot seem to be able to set the background color of a button independently from the colorPrimary of the Layout.
Here is my activity_main code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:background="@drawable/red_to_blue_back">
<Button
android:id="@+id/btnMovieList"
style="@style/Theme.MovieShow"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/round_button"
android:backgroundTint="#4CAF50"
android:text="Movie List" />
</RelativeLayout>
And here what I have in my created drawable file:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/custom"/>
<corners android:radius="150dp"/>
</shape>
However, the button does not take the color of the drawable file, but whatever color is set as a colorPrimary in the themes.xml file.
Any thoughts?
Thanks!