使用图库而不是 ViewSwitcher
我目前在我的应用程序中使用 ViewSwitcher 但现在我面临一个问题,因为我需要两个以上的视图之间进行切换。 由于 ViewSwitcher 不接受超过 2 个子级,因此我读到可以使用 Gallery 小部件来执行此操作。
ViewSwitcher中的每个视图都是不同的(一个是里面有ListView和Button的LinearLayout,另一个是里面有ImageView和TextView的LinearLayout)。
根据我的要求,我可以使用图库小部件吗?
有人能指出我正确的方向吗?一些教程/示例等等......?
谢谢。
I currently use a ViewSwitcher in my app but now I'm facing a problem because I need more than 2 views to switch between.
As ViewSwitcher does not accept more than 2 children, I've read that it's possible to use the Gallery widget to do so.
Each view in the ViewSwitcher is different (one is a LinearLayout with a ListView and a Button inside and the other one is a LinearLayout with an ImageView and a TextView inside).
Will I be able to use the Gallery widget given my requirements?
Can anyone point me to the right direction? Some tutorial/example or so..?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
ViewFlipper
,它允许您有两个以上的视图,并且它与ViewSwitcher
几乎相同(因为两者具有相同的超类)。我不建议在这种情况下使用GalleryView
因为您的所有视图都会不同,因此您的 Gallery 适配器将看起来像一堆垃圾。Use
ViewFlipper
which allows you more than 2 views and it's almost identical toViewSwitcher
(since both have the same super class). I don't recommend usingGalleryView
in this case since all your views will be different, thus your Gallery's adapter will look like a pile of crap.