我使用 Gallery 来显示照片。
触屏时图像可以滚动到之前的图像和后面的图像。
我想设置一个按钮来锁定 gallery 。
用的下面的代码来实现:
gallery.setEnabled(false);
但还是能通过触屏来滚动视图,如何来锁定 gallery ?
继承gallery重写里面的onFling方法
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY){
if (!enable)
return true;
else return super.onFling(e1, e2, velocityX, velocityY);
}