1

I've got a slight problem with colors in Android. I'm writing an app with a navigation drawer, so far so good. I know how to change the themes, so now the color of the toolbar and items changes, and this works fine. However, how do I programmatically change the color of the header of the navigation drawer? I can't find anything about it on Google.

3lil636wm
  • 7,580
  • 3
  • 24
  • 26
Ananas1232
  • 11
  • 3

1 Answers1

1

Add navigation header at run time:

View view = new View(context);
view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
view.setBackgroundColor(someColor);
navigationView.addHeaderView(view);
Rediska
  • 1,392
  • 10
  • 14