Last Updated: February 25, 2016
· wannabegeekboy

List view animation + Activity transition animation


Lets assume you have an Activity called A1 and A1 has a table/ listView in it.
When you tap on a row in A1 we want to display another Activity called A2.
From A1 to A2 we need the following animation.

  1. Lets say A1 has 10 rows and user taps on 5th row.
  2. The portion of screen till 5th row has to move up.
  3. The portion of screen from 6th row has to move down.
  4. A2 has to fade in from center as the above 2 animations happen.


Since Animations are supported from Android OS version 3.0 , I am checking if the Build version of the device and if it is less than 3.0 then I use a library called nineoldandroids's API for animations else I use android default Animation API to do the same.

In our application, the third animation is starting a new activity with a fade-in animation and since each activity has its own life cycle and the moment new activity is started with fade animation the currently running animation of the first activity ( portion of the screen moving up and portion of the screen moving down) gets a small lag.

To avoid the lag, its has been the mentioned that the we should do the following,

  1. Not to initiate animations onCreate, onStart, onResume.
  2. Initiate animations on user events such as onClick and hault user interaction until animation is complete.
  3. Not to aniamte more than 2 animations simultaneously

Kindly check my source code at: