How can I do a fade animation when the user rotates the phone?

Question!

My app's main screen is a listview in portrait mode. When it is in landscape orientation it switches to an ImageView. I want to be able to animate a fading transition when I switch orientations. How can I go about doing this?



Answers

I found a similar question: How to do a fadein of an image on an Android Activity screen?

that has the solution. Just need to make sure the animation is performed after the UI is mapped to the XML. Android kills the activity every time you rotate, so best place is onStart() or onCreate()



This video can help you solving your question :)
By: admin