I have a button that has a drawable background to make it round, but I am unable to modify the color of this button as setBackgroundColor, or setBackgroundResources won't work.
However, if I remove the drawable I can change the color. The color in the drawable xml file also has no effect on the color of the button as it seems to be overwritten by the theme.
How can I actually change the background color of this button while keeping it round ? Thank you (I am new to android studio).
Button :
<Button
android:id="@+id/PilotHeadset"
android:layout_width="252dp"
android:layout_height="wrap_content"
android:layout_below="@+id/selectedHeadset"
android:layout_centerHorizontal="true"
android:layout_marginTop="25dp"
android:background="@drawable/roundshapebtn"
android:bottomLeftRadius="10dp"
android:bottomRightRadius="20dp"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:text="Piloter un appareil"
android:topLeftRadius="20dp"
android:topRightRadius="20dp" />
Drawable :
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="10dp">
<solid android:color="@color/white"/> <!-- this one is the color of the Rounded Button -->
<corners
android:bottomRightRadius="20dp"
android:bottomLeftRadius="20dp"
android:topLeftRadius="20dp"
android:topRightRadius="20dp"
android:id="@+id/rndButton"
/>
</shape>