Некорректное отображение ImageView в CardView
Пытаюсь сделаю cardview в котором на всю ширину и длину будет натягиваться изображение. Если я напишу такой xml
<?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">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
app:cardBackgroundColor="@color/light_gray"
app:cardElevation="5dp"
app:cardCornerRadius="10dp">
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:ignore="ContentDescription" />
</androidx.cardview.widget.CardView>
</RelativeLayout>
то изображение корректно отображается на закругленных краях cardview, но мне помимо картинки, надо отобразить еще текст и поверх самого самой картинки View c полупрозрачным цветом, чтобы изменить общий тон картинки. Я сверстал это так
<?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">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
app:cardBackgroundColor="@color/light_gray"
app:cardElevation="5dp"
app:cardCornerRadius="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/light_gray">
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:ignore="ContentDescription" />
<RelativeLayout
android:id="@+id/unselectedTransparentLayer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_unselected_object_transparent_layer"/>
<TextView
android:id="@+id/id"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:fontFamily="@font/primary_font"
android:textColor="@color/light_gray"
tools:text="VIP 10" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>
В таком случае я сталкиваюсь с проблемой некорректного отображения картинки на закругленных гарях cardview
По углам появляются какие-то отступы белого цвета. Как мне решить эту проблему?
