[英]Handling tabs, actionbar, activities and fragments
I am facing problem in designing following scenario : 我在设计以下方案时面临问题:
Here, I decided to use ActionBar
and to change the view by using fragments to be called from onTabSelected()
of TabListener
; 在这里,我决定使用ActionBar
,并通过使用碎片来改变视图必须从称为onTabSelected()
的TabListener
; in which I was confused as I have to keep only single activity but multiple fragments. 在其中我感到困惑,因为我只保留一个活动,却保留多个片段。 'Keeping single activity' is this a standard / valid approach ? “保持单一活动”是一种标准/有效的方法吗? Please suggest. 请提出建议。
Thanks in advance. 提前致谢。
I know this is late, but I used a tabhost with fragments to do something similar. 我知道这很晚了,但是我使用了带有片段的tabhost来做类似的事情。 Here's a nice tutorial. 这是一个很好的教程。 http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/ http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/
您应该有一个Activity,并有一个容器(可以是一个空的LinearLayout),其中根据所选的选项卡替换了片段。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.