android circulate gallery iteration with 10 items.

Posted by Faisal khan on Stack Overflow See other posts from Stack Overflow or by Faisal khan
Published on 2010-05-17T11:55:21Z Indexed on 2010/05/17 12:00 UTC
Read the original article Hit count: 437

Filed under:
|

I am using the following customize gallery.

I am having static 10 images, i want circulatery gallery which should circlate always should never ends after last item it should auto start by 1 or after first it should auto start from end.

public class SizingGallery extends Gallery{

    public SizingGallery(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected boolean getChildStaticTransformation(View child, Transformation t) {
        t.clear();
        ImageView selectedChild = (ImageView)getSelectedView();
        ImageView iv =(ImageView)child;
        BrowseMapCategoryRow cr = (BrowseMapCategoryRow)iv.getTag();

        if (iv == selectedChild) {
            selectedChild.setImageResource(cr.getSelectedImgSrc());
        }else{
            iv.setImageResource(cr.getUnSelectedImgSrc());
        }
        return true;
    }

    @Override
    protected int getChildDrawingOrder(int childCount, int i) {

        return super.getChildDrawingOrder(childCount, i);
    }


}

© Stack Overflow or respective owner

Related posts about android

Related posts about gallery