I'm using the ImageView with custom shape (it works well) but lost once an image is set to that ImageView.
My ImageView:
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/imageView"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/custome_background"
android:scaleType="centerCrop" />
and the custom shape:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/buttonColorEnabled" android:state_enabled="true">
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="8dp" android:bottomRightRadius="8dp" android:topLeftRadius="8dp" android:topRightRadius="8dp" />
<stroke android:width="1dp" android:color="@color/colorBlack" />
</shape>
</item>
<item android:drawable="@color/buttonColorDefault" />
</selector>
Is there a way to preserve the ImageView shape when assigning a new image to the same? Thanks.