I'm trying to write a code that resizes a view's width and height by animating it, and to do that, what I've done is getting LayoutParams
of the view once, and every 16 ms get a width and a height value from an int[]
and change the width and height of the LayoutParams
using them, and finally do view.setLayoutParams(layoutParams);
to change the view's size.
This works fine, but it takes a little too much to .setLayoutParams()
, and so when I give it a duration value of 1000 ms, it takes around 1500 ms to finish animating.
You can see my code fully here. (P.S the code is not finished yet and I'm aware of it's problems)
Is there an alternative way to set width and height to a view that is faster? I thought about setting margin, but that has limitations for what I'm trying to do. Thanks.