Kindly help me on this to crop the imageview and textview with rounded corner in android. (Eg: Attached sample image)
Asked
Active
Viewed 321 times
2 Answers
2
You can try using CardView
with app:cardCornerRadius
equal to 1/2 of the height of the view.

Abhijeet Kumar
- 343
- 2
- 8
0
If your min version allows it you can use a ViewOutlineProvider.
You can apply this to any kind of view meaning you can just put your image and text in a layout and make the circular clipping on the layout.
view.clipToOutline = true
view.outlineProvider = object : ViewOutlineProvider()
{
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
override fun getOutline(view: View, outline: Outline) {
outline.setOval(0, 0, view.width, view.height);
}
}

Xavier Falempin
- 1,186
- 7
- 19