How to change Navigation drawer launcher icon color in Android -


i want change navigation drawer launcher default icon . want set custom icon how can please help.

enter image description here

above picture indicates 3 white line stacked on top of 1 in toolbar, want change icon.

here fragmentdrawer.java:-

    public class fragmentdrawer extends fragment {      private static string tag = fragmentdrawer.class.getsimplename();      private recyclerview recyclerview;     private actionbardrawertoggle mdrawertoggle;     private drawerlayout mdrawerlayout;     private navigationdraweradapter adapter;     private view containerview;     private static string[] titles = null;     private fragmentdrawerlistener drawerlistener;     private hashmap<string,string> category = new hashmap<>();     private list<string> cat_array = new arraylist<>();     private static string[] maintitle = null ;     private imageview iicon;      public fragmentdrawer() {      }      public void setdrawerlistener(fragmentdrawerlistener listener) {         this.drawerlistener = listener;     }      public static list<navdraweritem> getdata() {         list<navdraweritem> data = new arraylist<>();          //     log.d("who","1");         // preparing navigation drawer items         (int = 0; <1; i++) {             navdraweritem navitem = new navdraweritem();             navitem.settitle(titles[i]);             data.add(navitem);         }         return data;     }       @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);          //  log.d("who", "2");          // new homemenu().execute("http://opencart.codeniques.com/shopping/?route=feed/web_api/hmenu&key=test123$");          titles = getactivity().getresources().getstringarray(r.array.nav_drawer_labels);     }      @override     public view oncreateview(layoutinflater inflater, viewgroup container,                              bundle savedinstancestate) {         // inflating view layout         view layout = inflater.inflate(r.layout.fragment_navigation_drawer, container, false);         recyclerview = (recyclerview) layout.findviewbyid(r.id.drawerlist);          adapter = new navigationdraweradapter(getactivity(), getdata());         recyclerview.setadapter(adapter);         iicon = (imageview)layout.findviewbyid(r.id.iicon);         recyclerview.setlayoutmanager(new linearlayoutmanager(getactivity()));         recyclerview.addonitemtouchlistener(new recyclertouchlistener(getactivity(), recyclerview, new clicklistener() {             @override             public void onclick(view view, int position) {                 drawerlistener.ondraweritemselected(view, position);                 mdrawerlayout.closedrawer(containerview);             }             @override             public void onlongclick(view view, int position) {              }         }));          return layout;     }       public void setup(int fragmentid, drawerlayout drawerlayout, final toolbar toolbar) {         containerview = getactivity().findviewbyid(fragmentid);         mdrawerlayout = drawerlayout;         mdrawertoggle = new actionbardrawertoggle(getactivity(), drawerlayout,toolbar, r.string.drawer_open, r.string.drawer_close) {             @override             public void ondraweropened(view drawerview) {                 super.ondraweropened(drawerview);                 getactivity().invalidateoptionsmenu();             }              @override             public void ondrawerclosed(view drawerview) {                 super.ondrawerclosed(drawerview);                 getactivity().invalidateoptionsmenu();             }              @override             public void ondrawerslide(view drawerview, float slideoffset) {                 super.ondrawerslide(drawerview, slideoffset);                 toolbar.setalpha(1 - slideoffset / 2);             }         };          mdrawerlayout.setdrawerlistener(mdrawertoggle);         mdrawerlayout.post(new runnable() {             @override             public void run() {                 mdrawertoggle.syncstate();             }         });      }      public static interface clicklistener {         public void onclick(view view, int position);          public void onlongclick(view view, int position);     }      static class recyclertouchlistener implements recyclerview.onitemtouchlistener {          private gesturedetector gesturedetector;         private clicklistener clicklistener;          public recyclertouchlistener(context context, final recyclerview recyclerview, final clicklistener clicklistener) {             this.clicklistener = clicklistener;             gesturedetector = new gesturedetector(context, new gesturedetector.simpleongesturelistener() {                 @override                 public boolean onsingletapup(motionevent e) {                     return true;                 }                  @override                 public void onlongpress(motionevent e) {                     view child = recyclerview.findchildviewunder(e.getx(), e.gety());                     if (child != null && clicklistener != null) {                         clicklistener.onlongclick(child, recyclerview.getchildposition(child));                     }                 }             });         }          @override         public boolean onintercepttouchevent(recyclerview rv, motionevent e) {              view child = rv.findchildviewunder(e.getx(), e.gety());             if (child != null && clicklistener != null && gesturedetector.ontouchevent(e)) {                 clicklistener.onclick(child, rv.getchildposition(child));             }             return false;         }          @override         public void ontouchevent(recyclerview rv, motionevent e) {         }          @override         public void onrequestdisallowintercepttouchevent(boolean disallowintercept) {          }     }      public interface fragmentdrawerlistener {         public void ondraweritemselected(view view, int position);     } } 

i new android development please me.

try this

<style name="mytheme" parent="theme.appcompat">    <item name="drawerarrowstyle">@style/mydrawerarrowtoggle</item> </style>  <style name="mydrawerarrowtoggle" parent="widget.appcompat.drawerarrowtoggle">   <item name="color">@color/your_color</item> </style> 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -