java - ActionBarDrawerToggle() icon cannot be set to the ActionBar in Android SDK 5 -


i have simple problem initializing icon action bar. using android sdk 5 , since android.support.v4.app.actionbardrawertoggle; deprecated imported v7 support , replaced import following: android.support.v7.app.actionbardrawertoggle; i.e. same package v7.

now when initialize actionbardrawertoggle object associate drawerlayoutobject imported from: import android.support.v4.widget.drawerlayout; forced remove 1 argument, seems ok (have no idea why though!). icon not go in actionbar. here initialization actionbardrawertoggle object:

mactionbardrawertoggle = new actionbardrawertoggle(this, drawerlayout,             r.drawable.ic_drawer, r.string.drawer_open) {          /** called when drawer has settled in closed state. */         @override         public void ondrawerclosed(view view) {             super.ondrawerclosed(view);             invalidateoptionsmenu(); // creates call onprepareoptionsmenu()          }          /** called when drawer has settled in open state. */         @override         public void ondraweropened(view view) {             super.ondraweropened(view);             invalidateoptionsmenu(); // creates call onprepareoptionsmenu()          }     }; 

i have image in resource namely r.drawable.ic_drawer

i cant seem find why icon not appear in v7.

p.s. code works fine, infact when switch v4 import , add argument toggle object initialization (having bare ugly deprecated cross line ofcourse), icon appears not in v7.

thanks in advance :)

actually if @ javadoc of new v7.actionbardrawertoggle realize new class doesn't provide constructor, takes drawable argument - 3rd argument you've provided drawable string resourse describes opening drawer. if want set custom icon have use actionbardrawertoggle constructor:

actionbardrawertoggle(activity activity, drawerlayout drawerlayout, toolbar toolbar, int opendrawercontentdescres, int closedrawercontentdescres) 

in case toolbar's navigation icon used drawer icon


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -