You need to define shape firstly:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:bottomLeftRadius="8dp"
android:bottomRightRadius="8dp"
android:topLeftRadius="0dp"
android:topRightRadius="0dp" />
</shape>
Then use this shape as ImageView background:
<ImageView
android:id="@+id/img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/rounded"
android:src="@drawable/image"/>
And then in your activity write this code to add bottom rounded corners
img.outlineProvider = object : ViewOutlineProvider() {
override fun getOutline(view: View?, outline: Outline?) {
val corner = 48f
outline?.setRoundRect(0, -corner.toInt(), view!!.width, view.height,corner)
}
}
img.clipToOutline = true
If you want top corners to be rounded use:
outline?.setRoundRect(0, 0, view!!.width, (view.height+48f).toInt(), 48f)