Reputation: 6912
I use gallery to show several pictures. When finger touch and move on screen, the picture to previous or next one. But when the move distance large, the gallery may charge more than one picture. I want to limit it move one picture every time move. My code:
Gallery gallery = (Gallery) this.findViewById(R.id.gallery_photo);
gallery.setAdapter(new GalleryAdapter(this listPhotoURL));
gallery.setSelection(i);
listPhotoURL is string array; In GalleryAdapter, only show listPhotoURL[i] to imageview. How to arrive my goal?
Or modify listener method?
Upvotes: 1
Views: 871
Reputation: 15269
Below code might help you i.e you have to override
this method of Gallery
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
return false;
}
Upvotes: 2