我想創建一個像Facebook應用程序中那樣的提要,並且我想要使用actionbarsherlock導航選項卡來過濾提要 - 人員選項卡,地點標籤和項目標籤。如何使actionbarsherlock選項卡打開列表視圖而不是片段
現在我已經設置好了,以便每個選項卡打開一個片段。我怎樣才能讓他們打開一個列表視圖呢?
ActionBar.Tab itemsFeedTab = actionBar.newTab();
ActionBar.Tab peopleFeedTab = actionBar.newTab();
ActionBar.Tab placesFeedTab = actionBar.newTab();
Fragment itemsFeedFragment = new FeedItems();
Fragment peopleFeedFragment = new FeedPeople();
Fragment placesFeedFragment = new FeedPlaces();
itemsFeedTab.setTabListener(new MyTabsListener(itemsFeedFragment));
peopleFeedTab.setTabListener(new MyTabsListener(peopleFeedFragment));
placesFeedTab.setTabListener(new MyTabsListener(placesFeedFragment));
actionBar.addTab(itemsFeedTab, 0, true);
actionBar.addTab(peopleFeedTab, 1, false);
actionBar.addTab(placesFeedTab, 2, false);
class MyTabsListener implements ActionBar.TabListener {
public Fragment fragment;
public MyTabsListener(Fragment fragment){
this.fragment = fragment;
}
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
// TODO Auto-generated method stub
ft.replace(R.id.home, fragment);
}
是他們在facebook上使用的? –
我想,是的! 找不到任何單獨的'活動'列表.. – d3m0li5h3r
所以我的代碼將保持原樣,我只是在我的碎片中使用ListFragment? –