Gallery scroll one image at a time

后端 未结 3 978
无人及你
无人及你 2021-01-16 10:20

how to make a gallery control to scroll one image at a time? Also what is a good way of making a continuous loop of those images? I tried overriding onFling, does not work a

3条回答
  •  一向
    一向 (楼主)
    2021-01-16 11:09

    I created new control, called it CustomGallery and extended it from Gallery. In Custom Gallery I placed the following:

    @Override
           public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
             return super.onFling(e1, e2, 0, velocityY);
           }
    

    In my activity I am using CustomGallery instead of Gallery. This works. One thing, we moved from 2.2 to 2.3 (gingerbread). It didn't work for me before when I tried to override onFling. So I am suspecting this also have something to do with the version of OS.

提交回复
热议问题