I have below layout that has a CardView
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:padding="50dp"
>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="200dp"
app:cardBackgroundColor="@android:color/holo_red_light"
app:cardCornerRadius="50dp"
app:cardElevation="0dp"
app:layout_constraintTop_toTopOf="parent"
>
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/outline"
/>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
And my @drawable/outline
is just a stroke with corner radius same as cardCornerRadius
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="50dp" />
<stroke
android:width="3dp"
android:color="@color/white" />
</shape>
So, I was expecting a CardView
that has an outline. But this is what I get
Why does the radius of my stoke and radius of CardView are not the same and how to fix it?