0
在我的应用程序不同的布局,我有一个列表视图中使用Web服务,显示结果的搜索活动。我要添加3个标签导航(“清单当然”,“点”和“照片”)。 “聆听”是默认选项卡。点击“carte”时,结果显示在地图上。当点击“照片”时,它们使用另一种布局显示。正是这样的应用程序:ActionBarSherlock标签导航 - 相同的列表视图数据,但每个标签
我能够添加的标签导航,但我不知道如何显示使用不同的布局,每个标签的结果。
public class SearchableActivity extends SherlockActivity implements ActionBar.TabListener {
ListView listViewData;
ProductAdapter productAdapter;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.cproduct_list);
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
ActionBar.Tab tab1 = getSupportActionBar().newTab();
tab1.setText("Liste");
tab1.setTabListener(this);
getSupportActionBar().addTab(tab1);
ActionBar.Tab tab2 = getSupportActionBar().newTab();
tab2.setText("Carte");
tab2.setTabListener(this);
getSupportActionBar().addTab(tab2);
ActionBar.Tab tab3 = getSupportActionBar().newTab();
tab3.setText("Photo");
tab3.setTabListener(this);
getSupportActionBar().addTab(tab3);
listViewData = (SwipeListView) findViewById(android.R.id.list);
handleIntent(getIntent());
}
}
谢谢。事情现在更加清晰。这是我的理解:我要创建1个活性(其延伸FragmentActivity所述可搜索的活性),为每个标签3个片段,它包含的FrameLayout 1点的布局,以及布局3为每个标签。 但我的搜索活动调用webservice的,我不知道处理这个问题。如何将Web服务数据传递给碎片? – tsil
您可以通过以下链接查看是否将数据传递给Fragment:http://developer.android.com/guide/components/fragments.html#CommunicatingWithActivity – zennon