Android:在图像视图中显示图像数组
我想从可绘制对象中一张一张地加载图像数组。在给定时间,当用户滑动时,ImageView 应该显示一张图像,它应该加载下一张图像。
我能达到这个目的吗??我不喜欢图库视图,我直接需要加载填充屏幕并滑动到数组末尾的单个图像。
预先感谢您的宝贵时间。
I want to load array of Images one by one from drawable. At a given time the ImageView should display one image when user slides, it should load the next Image.
Can I acheive this?? I don't like gallery view, I directly need to load the single image dat fills the screen and slides through till the end of Array.
Thanks in advance for your time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
查看 ImageSwitcher。它应该适合您的需求。
Take a look onto ImageSwitcher. It should fit your needs.
我有一个不同的解决方案:
https://github.com/ysamlan/horizontalpager
这是一个 ViewGroup,您可以在其中添加子项,当向左或向右滑动时,您将全屏显示下一个或上一个子项。它还被编写为可以在您需要时实现垂直滚动。
I have a different solution:
https://github.com/ysamlan/horizontalpager
It's a ViewGroup where you can add children, when swiping left or right, you will show the next or previous child in fullscreen. It's also written so that it's possible to implement vertical scrolling in case you need this.
您可以使用
ViewFilpper
或ViewSwitcher
或ImageSwitcher
以满足您的目的。所有这些类都扩展了ViewAnimator
,因此它们具有非常相似的行为和功能,并且仅在ViewAnimator
的基础上添加了一些有用的功能。演示:http://www.youtube.com/watch?v=mGwG8-chUEM
You can use
ViewFilpper
orViewSwitcher
orImageSwitcher
for your purposes. All these classes extendViewAnimator
, so they have very similar behavior and functionality, and only add a few useful function on top of whatViewAnimator
has.Demo: http://www.youtube.com/watch?v=mGwG8-chUEM
经过几个小时的思考后,我想出了解决方案,因为没有一个答案对我有帮助。
Java代码
After thinking for hours I came up with solution as none of the answers helped me.
Java Code