Round Any Image

Round Any Image

Make Image round Without Using External Library or CardView

 

In Activity Xml File

  • use <com.google.android.material.imageview.ShapeableImageView ... /> tag
  • make scaleType = “centerCrop”
  • add app:shapeAppearanceOverlay="@style/roundedImageView"
<com.google.android.material.imageview.ShapeableImageView android:layout_width="200dp" android:layout_height="200dp" android:scaleType="centerCrop" android:src="@drawable/dummy2" app:shapeAppearanceOverlay="@style/roundedImageView" />
 

Create new Style Resource File in Values Folder

<?xml version="1.0" encoding="utf-8"?> <resources> <style name="roundedImageView"> <item name="cornerFamily">rounded</item> <item name="cornerSize">50%</item> </style> </resources>