Gallery默认可以滑动多页,想要实现每次只滑动一页,可以重写Gallery的onFling方法,代码如下:
public class MyGallery extends Gallery {
public MyGallery(Context context) {
super(context);
}
public MyGallery(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
return false;
}
}