How to generate views as shown below,
I tried to adding stroke to cardView(Material cardView) and using it in a recyclerView. I have used multiple views, below is the xml code for the outer ring
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:gravity="center">
<com.google.android.material.circularreveal.cardview.CircularRevealCardView
android:id="@+id/selectedCardColor"
android:layout_width="40dp"
android:layout_height="40dp"
android:visibility="visible"
app:cardBackgroundColor="@color/app_color_white"
app:strokeColor="@color/app_color_green"
app:strokeWidth="1dp"
app:cardCornerRadius="28dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="false">
<com.google.android.material.circularreveal.cardview.CircularRevealCardView
android:id="@+id/selectedCardInnerColor"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="center"
android:layout_margin="6dp"
app:cardBackgroundColor="@color/app_color_green"
app:cardCornerRadius="28dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="false" />
</com.google.android.material.circularreveal.cardview.CircularRevealCardView>
</LinearLayout>
and the code for circle shape,
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/parent"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp">
<com.google.android.material.card.MaterialCardView
android:id="@+id/unSelectedCardColor"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
app:cardBackgroundColor="@color/app_color_green"
app:cardCornerRadius="28dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="false" />
</LinearLayout>
It works only in pie(android 9) and above. Other devices it appears as below,
The ring should appear on selected views. I should be able to change color programmatically. Thanks.

