0

I have MYGallery class extended by Gallery. onSwipe onFling method is not getting called what need to do.

code is as below

public MyGallery(PhotoAlbumDetailActivity context) {
        super(context);
        this.context = context;
        this.setFadingEdgeLength(0);
        //this.setSpacing(10);
    }

public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
  System.out.println("On Fling");
  return true;
}

in my main activity this.mConverseGallery = new ConverseGallery(this);

4

1 回答 1

0

onFling()方法必须返回一个布尔值:

public MyGallery(PhotoAlbumDetailActivity context) {
    super(context);
    this.context = context;
    this.setFadingEdgeLength(0);
    //this.setSpacing(10);
}

public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
    Log.i("test", "onFling()");
    return super.onFling(e1, e2, velocityX, velocityY);
}
于 2012-11-05T16:58:06.797 回答