androidandroid-appcompatactionbardrawertoggle

ActionBarDrawerToggle customization


How to change icon for ActionBarDrawerToggle in android using AppCompat V7? Also, how can we specify params and padding etc for ActionBarDrawerToggle icon?


Solution

  •     Toolbar toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar);
         setSupportActionBar(toolbar);
         toolbar.setNavigationIcon(R.drawable.ic_good);
    

    Add these lines in your onCreate() method , also add

    toolbar.setNavigationIcon(R.drawable.ic_good);

    add this line after

    toggle.syncstate();

    and also in toggle listeners. Android will pick default icon every time you open or close the drawer, so its important to put this line in toggle listeners also.