android - The method setHomeAsUpIndicator is undefined for the type ActionBarDrawerToggle -
i'm trying use support v4 actionbardrawertoggle
in order change action bar indicator arrow instead of navigation drawer's 3 dots. i'm using v4 fragment
, v4 drawerlayout
, v7 actionbar
, v7 actionbaractivity
.
this how have used it:
in oncreate:
drawerlayout drawerlayout = (drawerlayout) findviewbyid(r.id.drawer_layout); mdrawertoggle = new actionbardrawertoggle(this, drawerlayout, r.drawable.ic_drawer, r.string.navigation_drawer_open, r.string.navigation_drawer_close);
when try change indicators, got no problems calling setdrawerindicatorenabled
on actionbardrawertoggle
above error when trying call sethomeasupindicator
. can call sethomeasupindicator
on getsupportactionbar()
:
public void turnonactionbarupindicator() { mdrawertoggle.setdrawerindicatorenabled(false); getsupportactionbar().setdisplayhomeasupenabled(true); getsupportactionbar().sethomeasupindicator(null); //this compiles mdrawertoggle.sethomeasupindicator(null); //this line not compile }
this results in indicator's being changed not it's functionality meaning see arrow indicator, opens drawer instead of going backstack.
how can both , functionality of actionbar
?
arguably, if you've got left drawer navigation can opened swipe left, should have hamburger in top left opening up. makes navigation hierarchy sorta messy, because doesn't obey common conventions how hamburger menu works.
second, v4 toggle deprecated, use v7.
Comments
Post a Comment