Android如何改变视图?
基本上我需要一些建议,这是在我的情况下切换视图的最佳方式。我的应用程序有 5 个不同的选项卡。在每个选项卡中,我都使用活动管理器来启动该选项卡内所需的尽可能多的活动。现在我有一个小问题。在其中一个选项卡中,我需要创建类似三个不同选项卡的内容。在第二个选项卡中,我使用了 3 个按钮,它们通过 viewflipper 切换视图。但现在我需要在每个新选项卡(或按钮)中切换大约 2 或 3 个视图。我用 viewflipper 做到了,但这实际上不是我想要的,因为我想使用后退按钮在视图之间切换。
示例:
MAIN TAB BAR : ONE TWO THREE FOUR FIVE
SECOND TAB BAR INSIDE TAB THREE / OR JUST THREE BUTTONS : TAB-A TAB-B TAB-C
IN TAB-A I have only one view.
IN TAB-B I have 2 views. View 1 is a listView and onItemClick switch view 2.
IN TAB-C I have same scenario like in TAB-B.
P.S. View 1 and View 2 directly can change to TAB-C.And I need to be able to send data between the views/activities.
有什么建议吗? ViewFlipper
或其他东西。
Basically I need some suggestions which is the best way to switch views in my situation. My Application has 5 different tabs. In every single tab I'm using activity manager to start as many activities that I need inside this tab. Now I have a little problem. In one of the tabs I need to create something like three different tabs. In second tabs I used 3 buttons, which switch the views via viewflipper. But now I have like 2 or 3 views inside every new tab (or button) which I need to switch. I did it with viewflipper but it's actually not what I want, because I want to use back button to switch between views.
Example:
MAIN TAB BAR : ONE TWO THREE FOUR FIVE
SECOND TAB BAR INSIDE TAB THREE / OR JUST THREE BUTTONS : TAB-A TAB-B TAB-C
IN TAB-A I have only one view.
IN TAB-B I have 2 views. View 1 is a listView and onItemClick switch view 2.
IN TAB-C I have same scenario like in TAB-B.
P.S. View 1 and View 2 directly can change to TAB-C.And I need to be able to send data between the views/activities.
Any suggestions how to do that? ViewFlipper
or something else.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最好使用选项卡“三”内的活动并创建三个启动新活动的按钮。您可以在这些活动中使用 ViewFlipper 来更改视图或视图开关。这取决于您的需求。
Better use activities inside the tab THREE and create three buttons which starts new activity.And you can use ViewFlipper inside these activities to change the views,or viewswticher.It depends on your needs.
您可以覆盖 Activity 中的 onBackPressed 来更改后退按钮的默认行为
http://developer.android.com/reference/android/app/Activity.html#onBackPressed()
You can override the onBackPressed in your activity to change the default behaviour of the back button
http://developer.android.com/reference/android/app/Activity.html#onBackPressed()