Thursday, 15 August 2013

android - Drawer Indicator does not show -



android - Drawer Indicator does not show -

i can't have drawer indicator display. have either nil or "<" @ top left corner of screen depending of actionbar settings. want drawer indicator of nagivation drawer instead.

i utilize :

v4.widget.drawerlayout v7.app.actionbardrawertoggle but android.app.actionbar (not back upwards 7 one).

here snippet of code :

@override protected void oncreate(bundle savedinstancestate) { actionbar.setdisplayhomeasupenabled(true); actionbar.sethomebuttonenabled(true); actionbar.setdisplayshowhomeenabled(true); //i tried combinations unsuccessfully .... drawer = (drawerlayout) findviewbyid(r.id.drawer_layout); drawerlv = (listview) findviewbyid(r.id.left_drawer); drawer_linearlayout = (linearlayout) findviewbyid(r.id.drawer_linearlayout); drawerlv.setadapter(new arrayadapter<string>( this, r.layout.layout_main_drawer_list_item, mdraweritems)); drawerlv.setonitemclicklistener(new listview.onitemclicklistener() { @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { selectitem(position); } }); drawertoggle = new actionbardrawertoggle(this, drawer, r.string.drawer_open,r.string.drawer_close) { @override public void ondrawerclosed(view view) { actionbar.settitle(mtitle); } @override public void ondraweropened(view drawerview) { actionbar.settitle(mdrawertitle); } }; drawertoggle.setdrawerindicatorenabled(true); drawer.setdrawerlistener(drawertoggle); }

i fixed problem. forgot add together next callback in acticity :

protected void onpostcreate(bundle savedinstancestate) { super.onpostcreate(savedinstancestate); // sync toggle state after onrestoreinstancestate has occurred. drawertoggle.syncstate(); }

by way, lollipop upgrade of v7.app.actionbardrawertoggle adds nice effect when navigation drawer opening or closing. recommend it.

android drawerlayout indicator

No comments:

Post a Comment