I have an InsetDrawable
defined, and I would just like to be able to adjust the value of the inset at runtime, without re-assigning another drawable.
Is this possible?, or is the only way is to re-create the InsetDrawable?
It is not possible, because the API for that is not public. I had the same problem as you did, but in my case I had to animate the insets, so recreating the drawable was a quite costly option.
In the end I copied the source code of InsetDrawable, and added a method for changing the inset.
You can check it out here. Use the method setInsets()
for changing the insets.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With