10

I want to animate the items of the list view. At Present i am applying the Transition Animation on the list items whenever new items are added. But this is not the animation i want to achieve. I want that when a new item is added in the list view at that time the whole List view move a place down to make way for the newly added item.

Currently the code i am using is :

set = new AnimationSet(true);

    animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setDuration(50);
    set.addAnimation(animation);

    animation = new TranslateAnimation(
        Animation.RELATIVE_TO_SELF, 0.0f,Animation.RELATIVE_TO_SELF, 0.0f,
        Animation.RELATIVE_TO_SELF, -1.0f,Animation.RELATIVE_TO_SELF, 0.0f
    );
    animation.setDuration(150);
    set.addAnimation(animation);

    LayoutAnimationController controller = new LayoutAnimationController(set, 1.0f);
    l.setLayoutAnimation(controller);
    l.setAdapter(listAdaptor);

And then while adding items through button onClick

    l.startLayoutAnimation();

Any other suggestions to achieve such animation.

Macarse
  • 91,829
  • 44
  • 175
  • 230
ASH
  • 2,748
  • 2
  • 28
  • 29

0 Answers0