My Question Description
In this screenshot there are two ListView
s.
What I want to achieve is when I touch the purple ListView
, the touched cell will move up and stop at the position of bottom of the blue ListView
.
For example, if I touched "Decision Heart Transplant", then their will be an animation showing this cell moves up, then stops at the position of "Liver Transplant".
What I Have Tried
I have tried this in the purple ListView
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
// Setup the animation view
Log.d("onListItemClick", "Position: " + viewForAnim.getX() + ", " + viewForAnim.getY());
// Move up the selected view
Animation animation = null;
animation = new TranslateAnimation(0, 0, 0, -v.getY()-l.getY());
animation.setDuration(700);
v.startAnimation(animation);
}
But this seemed will move the selected cell within the listview's bound, it can't move out of it.
Thinking that the animated purple listview's cell might be covered by the blue listview, I even tried change the listview's z-order by using
l.bringToFront();
However that didn't work either.
and I also tried the approach showed in this SO Post
Android -- How to position View off-screen?
it might work well for animating a view, but that didn't work for my case.
Then I tried setting the android:clipChildren
and that didn't work for the animation that requires moving cell out of listview.
So could you guys point me a right way how to achieve this animation effect?