Android Gallery 更改幻灯片上的单个图像
我使用了画廊视图,它占据了整个屏幕空间。通常,当用户向左或向右滑动时,根据用户滚动力,图像会左右移动。我希望当用户向左或向右滑动时,即使用户几乎不滑动它,一次也只有一个图像移动。有什么想法吗?
I have used a gallery view which takes the whole space of screen. Normally when user slides left or right, depending upon the user scrolling force, images are moved right and left. I want that when user slides left or right, only a single image moves at a time even if user slides it hardly. Any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要创建一个扩展画廊类的自定义画廊,然后重写 onfling 方法。您可以参考下面的代码:
包挂.view;
public class CustomGallery extends Gallery {
}
最后,在布局 xml 文件中,将默认画廊替换为自定义画廊,示例:
我希望它对您有用。
此致
You need to create a custom gallery that extends gallery class, and then you override onfling method. You can refer the code below :
package hung.view;
public class CustomGallery extends Gallery {
}
The last, in the layout xml file, you replace default gallery by custom gallery, example :
I hope it is useful for you.
Best regards
您可以为滚动事件编写自己的事件监听器,您可以在其中更改图像。
You can write your own eventListener for scrolling event where you can change the image.