android circulate gallery iteration with 10 items.
- by Faisal khan
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);
}
}