如何刷卡图像 [英] How to swipe images

查看:69
本文介绍了如何刷卡图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现一个简单的图像库,其中我有一次要在设备屏幕上显示的图像.当我们从左向右滑动屏幕时,它应该显示下一张图像.
为此,我实现了一个视图脚蹼,并向其中添加了图像视图.
但是我不知道该如何捕捉滑动事件.
谁能告诉我一个例子吗?

I am trying to implement a simple gallery of images in which I have an image to be displayed at a time on the device screen. When we swipe the screen from left to right it should show the next image.
For that I implemented a view flipper and added image views to it.
But I don't know how to catch that swipe event.
Can anyone tell me with an example?

推荐答案

我的应用需要相同的东西,并使用了 ViewPager : http://blog.sqisland.com/2012/09/android-swipe-image-viewer-with-viewpager.html

I needed the same thing for my app, and used a ViewPager: http://blog.sqisland.com/2012/09/android-swipe-image-viewer-with-viewpager.html

以前,我将 ImageSwitcher GestureDetector 结合使用:

Previously I used a ImageSwitcher combined with a GestureDetector: http://blog.sqisland.com/2012/07/android-swipe-image-viewer.html

使用 ViewPager 的代码要简单得多,而且体验也要好得多,因为当手指在屏幕上滑动时图像会滑动.我直接创建 ImageView ,不需要任何片段.

The code with ViewPager is much simpler, and the experience is much better because the image slides as your finger swipe across the screen. I create ImageView directly, no fragments required.

这篇关于如何刷卡图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆