I'm creating ImageView programmatically and I am trying to set different corner radius for each corner:
val imageView = ImageView(context)
imageView.setImageDrawable(context.getDrawable(R.drawable.ic_launcher_background))
imageView.clipToOutline = true
val shape = GradientDrawable()
shape.shape = GradientDrawable.RECTANGLE
shape.cornerRadii = floatArrayOf(100f, 100f, 100f, 100f, 0f, 0f, 0f, 0f)
imageView.background = shape
it's seems that cornerRadii
does not work.
if i'm using shape.cornerRadius = 100f
its working but for all the corners.
I've also tried to call mutate()
before setting the cornerRadii
but it did not affected the ImageView.