Android Actionbar Tabs like Facebook app -
im developing android app, , want tab navigation facebook app.
im using native actionbar code:
final actionbar actionbar = getactionbar(); actionbar.setnavigationmode(actionbar.navigation_mode_tabs); actionbar.addtab(actionbar.newtab().seticon(r.drawable.warnung).settablistener(this)); actionbar.addtab(actionbar.newtab().seticon(r.drawable.warnung).settablistener(this)); actionbar.addtab(actionbar.newtab().seticon(r.drawable.warnung).settablistener(this)); @override public void ontabselected(tab tab, fragmenttransaction ft) { // todo auto-generated method stub switch(tab.getposition()){ case 0: fragment fragment = new nachrichten_fragment(); getsupportfragmentmanager().begintransaction().replace(r.id.content_frame,fragment).commit(); break; } }
my problem unlike in facebook app, android creats tab bar below action bar , not inside it.
so can tell me how create such navigation ? or need actionbar sherlock ?
thanks in advance
you can use custom view inside actionbar
. can use
getsupportactionbar().setcustomview()
this way can both put tabs in actionbar
, make them appear @ middle of actionbar
.
or can disable app title , logo using below functions , tabs @ top automatically.
getsupportactionbar().setdisplayshowhomeenabled(false); getsupportactionbar().setdisplayshowtitleenabled(false);
Comments
Post a Comment