0

I'm trying to show an image with a rounded view inside a cardview, and strangely I don't get the corners of the image rounded but flat. I'm compiling with API level 29.

<androidx.cardview.widget.CardView
                            xmlns:card_view="http://schemas.android.com/apk/res-auto"
                            android:id="@+id/thumb"
                            android:layout_width="370dp"
                            android:layout_height="370dp"
                            android:layout_gravity="center_horizontal"
                            android:layout_marginTop="25dp"
                            android:visibility="visible"
                            card_view:cardCornerRadius="4dp"
                            card_view:cardUseCompatPadding="true"
                            card_view:cardPreventCornerOverlap="false"
                            app:cardElevation="0dp">

                            <ImageView
                                android:id="@+id/image"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:scaleType="centerCrop"
                                android:src="@drawable/ic_thumbnail" />

Worth noting I'm using Picasso to load the image. Any help on this matter is highly appreciated.

expected results: That's the expected result:

actual result: That's the real output:

user1528465
  • 53
  • 1
  • 8
  • when loading img with picasso, you can try this https://stackoverflow.com/a/30707381/11178991 – AyTee Apr 22 '20 at 16:24
  • @AyTee - I'd rather use the layout XML instead of coding this as in your attached link, just to keep consistency with other practices I implemented. – user1528465 Apr 22 '20 at 16:44

1 Answers1

0

You can use above attribute in ImageView:

android:scaleType="fitXY"
ImanX
  • 789
  • 6
  • 23