Home > Blockchain >  Card View with round corner API 27
Card View with round corner API 27

Time:01-03

Below this is my code :

<androidx.cardview.widget.CardView
    android:layout_width="78dp"
    android:layout_height="78dp"
    android:layout_gravity="center"
    app:cardBackgroundColor="?colorSecondary"
    app:cardCornerRadius="250dp">

    <ImageView
        android:id="@ id/customer_image"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:contentDescription="@string/content_description"
        android:scaleType="centerCrop"
        android:src="@drawable/ic_no_picture" />

</androidx.cardview.widget.CardView>

It works perfectly with API 30/29/28 but for API 27 i just have an empty CardView. Do you have any idea ?

CodePudding user response:

There are many libraries on github which makes Imageview in circular shape. You can explore github.

Here is the one of its's kind for CircularImageView

CodePudding user response:

I just found a way to fix my problem, with API 27 to have circular image with cardView you have to put cardCornerRadius to a maximum of width / height. In my example i just write app:cardCornerRadius="39dp" and it works perfectly.

  • Related