移动图库视图下一个图像上一刷卡Android中?上一、视图、图像、图库

2023-09-05 09:39:39 作者:荒年旧

我在画廊查看四象。当我们从左至右或从右到左的画廊查看刷卡移动所有的图像,即,如果我从左至右,从第一张图像右轻扫,然后它会移动到所有四个图像。

I have four images in the Gallery View. When we do swipe from left to right or right to left the Gallery View moves all the images i.e if I swipe from left to right from the first image then it will move to all the four images.

我要的是,当我刷它应该只移动到下一个图像。有人可以让我知道,这怎么可能?

What I want is that when I swipe it should only move to the next image. Can someone let me know how is this possible?

希望能得到答复很快。

问候 苏尼尔

推荐答案

我通过创建一个 CustomGallery 类扩展来实现这个图库。然后我推翻图库 onFling 方法。在 onFling 的方法,简单地返回false。这将导致画廊只有移动的时候 onFling 被称为下一个图像。

I accomplished this by creating a CustomGallery class that extends Gallery. I then Overrode the onFling method of Gallery. Inside the onFling method, simply return false. This will cause the Gallery to only move to the next image when onFling is called.