安卓广告横幅
我想实现一个旋转横幅。什么控件最适合这样的 UI?
这是它需要做的:
- 每个视图旋转 1 个图像
- 仅在滑动(或所谓的 onFling())时旋转它们
- 记住当前横幅的索引,并在用户重定向到另一个活动时显示下一个横幅
- 两个方向旋转都是无限的
因此,本质上,当您进入第一个活动时,会显示第一个索引。当您滑动时,它应该显示下一个或上一个图像,具体取决于滑动是向左还是向右。这应该在无限循环中迭代。
先感谢您
I want to implement a rotating banner. What control is best suitable for such UI?
here is what it needs to do:
- rotate 1 image per view
- rotate them only on swipe (or what's called onFling())
- remember the index of the current banner and show next banner when user is redirected onto another activity
- rotation is infinite in both directions
So essentially when you land on first activity the first index is shown. When you do swipe it should show next or previous image depending if the swipe is to the left or to the right. This should iterate in the infinite loop.
Thank you in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果有人想要解决方案,这里是代码:
In case anybody wanted the solution, here is the code:
http://permalink.gmane.org/gmane.comp.handhelds.android .devel/101327 此代码可以帮助您创建旋转的 onFling 视图。只要去掉无用的功能就差不多完成了。
为了记住当前的横幅,您可能必须将横幅类创建为 Singletone,然后加载它的实例和状态以了解当前显示的横幅。
http://permalink.gmane.org/gmane.comp.handhelds.android.devel/101327 This code may help you creating rotating onFling views. Just cut off useless functionality and you are nearly done.
In order to remember the current banner you will probably have to create the banner class as a Singletone and then load it's instance and state to learn which banner is shown currently.