I made a box.xml file and it looks like this
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#FF9800"></solid>
<corners android:radius="10dp"></corners>
</shape>
</item>
</selector>
For my cardview, I added android:background="@drawable/box"
but the colour didn't change
CodePudding user response:
Cardview has is all include shape ,color,radius
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardElevation="10dp"
app:cardCornerRadius="20dp"
android:layout_margin="10dp"
app:cardBackgroundColor="@color/white"
app:cardMaxElevation="12dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true"
>