i want to change border color for imageview manually in kotlin.
val backgroundGradient = imgIcon.getBackground() as GradientDrawable
backgroundGradient.setColor(getResources().getColor(R.color.yellow))
i tried this but it's not working.
i want to change border color for imageview manually in kotlin.
val backgroundGradient = imgIcon.getBackground() as GradientDrawable
backgroundGradient.setColor(getResources().getColor(R.color.yellow))
i tried this but it's not working.
you can use this method
backgroundGradient.setStroke(width : Int, color : Int)
there are other options available you can pass to method
You need to use setStroke
method to change border color of imageview.
backgroundGradient.setStroke(1, ContextCompat.getColor(context, someColorId))