I am creating a custom Button and I am using the Drawable.setTintList to have colors for default,pressed and disabled states.
I want to actually add a border to the button, which I am trying by doing:
val d = newGradientDrawableForShape()
d.setShape(GradientDrawable.RECTANGLE)
d.setColor(Color.WHITE)
d.setStroke(20, Color.GREEN)
With this the border is not visible, however if I do not use tint list then I do see the border.
Is there a way I can use setStroke and TintList?
I tried d.setStroke(width, colorList) and it didn't work either.
I have the same issue but I also achieved another approach.
Here's the XML:
Here's the code:
The idea is to set background to two views and the top view covers the "border" base view but leaves a
1dp
margin to be the "border".So that you will have a gradient background in the view and also the gradient background in the border.