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