When I saw for the first time the Instagram login screen on Android, my first thought was like wow, how do they do it.

Instagram Login Screen

So, the code is very simple.

First of all, define your colors on colors.xml

Then create different file on drawable folder with your gradient (gradient_1.xml gradient_2.xml etc etc)

The angle of the gradient, in degrees. 0 is left to right, 90 is bottom to top. Use multiples of 45.

Now, create animation_list.XML always in the drawable folder

… and set your layout’s background with the animation_list

Now you are ready to start the animation!

Source code at: https://github.com/deval93/GradientTransition

What Others Are Reading

Leave a Reply

Your email address will not be published. Required fields are marked *