animate ListView Item Removal - Android User Interface

Android examples for User Interface:ListView

Description

animate ListView Item Removal

Demo Code


//package com.java2s;
import android.view.View;
import android.view.animation.Animation;
import android.widget.ListView;

public class Main {
    public static void animateListViewItemRemoval(Animation anim,
            ListView listItems, int position) {

        int wantedPosition = position;
        int firstPosition = listItems.getFirstVisiblePosition()
                - listItems.getHeaderViewsCount(); // This is the same as child #0
        int wantedChild = wantedPosition - firstPosition;
        View wantedView = listItems.getChildAt(wantedChild);
        wantedView.startAnimation(anim);

    }//  ww w. j a  v  a 2 s  .  c  o m
}

Related Tutorials