简体   繁体   English

处理标签,操作栏,活动和片段

[英]Handling tabs, actionbar, activities and fragments

I am facing problem in designing following scenario : 我在设计以下方案时面临问题:

  1. Showing 3 tabs for contact-lists (all, friends and family) 显示3个联系人列表选项卡(所有人,朋友和家人)
  2. All tabs would contain contact-list as per the groups 所有选项卡将包含按组列出的联系人列表
  3. Any contact could be selected and viewed but should be in the same tab (either all,family or frnds) 可以选择和查看任何联系人,但应在同一选项卡中(全部,家庭或朋友)
  4. In short, tabs should be available globally. 简而言之,选项卡应该全局可用。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM