animate ListView Item - Android User Interface

Android examples for User Interface:ListView

Description

animate ListView Item

Demo Code


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

public class Main {
    public static void animateListViewItem(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);

    }// www  .  j a  v a 2s.  co  m
}

Related Tutorials