Is there a way to set up the gallery view so that only one image is in view at a time? I have created a gallery view with thumbnails of images. As the user clicks on an image, I want to start a new activity which displays the actual selected image in a new gallery view. Now when the user swipes his finger, he can then see the subsequent image. Is there a way to achieve this?
Got an alternative solution figured out while searching on the web. The simpler solution is to subclass the Gallery class and just set onFling to always return false. Here is the reference to the solution:
How can I limit fling in Android gallery to just one item per fling?
Here is my combined implementation based on inputs from users "Someone Somewhere" and "vmihalca" as listed in the above link:
public class SlowGallery extends Gallery {
public SlowGallery(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public SlowGallery(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SlowGallery(Context context) {
super(context);
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
return false;
}
}