Android — How to change the height of a view using animation

Anitaa Murthy
1 min readDec 6, 2018

--

So there have been times when I needed to hide a view or show a view based on some requirement. Recently, I had to change the height of a view based on some result from api. But it seemed like a bad user experience to just change the height. So I thought of adding animation to it.

So I created a simple util class to achieve this animation. We use ValueAnimator to change the height from one value to another.

How to use this?

Sample output you would get:

Thanks for reading guys! If you are interested in more anecdotes like this, please checkout my Github project.

Happy Coding!

--

--