0

I am trying to change the drawer icon programmatically (when using the DrawerLayout thats the icon with the 3 lines). In the drawer I can set some properties inside my app, and when those properties are set I would like to change the color of lines (in my case this would mean that I replace the icon) of the drawer icon indicationg to the user that there are properties set. I have tried to create a new Actionbardrawertoggle but the icon didn't change.

Cœur
  • 37,241
  • 25
  • 195
  • 267
user3466562
  • 465
  • 2
  • 10
  • 23
  • 1
    I haven't worked with the support library `DrawerArrowDrawable` but you should be able to use `drawable.setColorFilter(yourColor, PorterDuff.Mode.SRC_ATOP);` to change the color. – Jared Rummler Nov 09 '14 at 21:16
  • that actually works great when setting the actionbar for the first time(in onCreate). But my problem ist when i try to update the color based on some user input – user3466562 Nov 09 '14 at 22:13
  • 1
    So just make a reference to the drawable and then create a listener for any input and change the color from there. – Jared Rummler Nov 10 '14 at 06:34
  • It seems like that did the trick. Every time i was changing the color i was searching for the resrouce - this.getResources().getDrawable(R.drawable.ic_drawer) - because i thought that android keeps track of it (because there is just one object with this id). But when keeping an reference to the drawable inside my activity it works. – user3466562 Nov 10 '14 at 11:01

0 Answers0