how to set background to general view in android
check if the view is Viewgroup or not
fun View.customBg(backgroundColor: Int, borderColor: Int) {
val shape = GradientDrawable()
shape.shape = GradientDrawable.RECTANGLE
shape.cornerRadii = floatArrayOf(8f, 8f, 8f, 8f, 0f, 0f, 0f, 0f)
shape.setColor(backgroundColor)
shape.setStroke(3, borderColor)
if (this is ViewGroup) {
this.background = shape
}
}