android - ActionBarSherlock Tab Navigation - Same listview data but different layouts for each tab -
in app, have searchable activity displays results using webservice in listview. want add 3 tabs navigation ("liste", "carte" , "photo"). "liste" default tab. when clicking on "carte", results displaying in map. when clicking on "photo", displayed using layout. app:
i able add tab navigation don't know how display results each tab using different layouts.
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()); } }
you have use fragmentpageradapter , each tab must create fragment.. there example code available android..
if create in eclipse android project can choose different navigation options. selecting 1 of tab navigation options project created implemented tab navigation want..
Comments
Post a Comment