Set Background Color of Navigation Drawer

前端 未结 3 1936
无人共我
无人共我 2021-02-03 18:23

I wanted to set the background color of my Navigation drawer in java but it seems as setBackgroundColor and all similar methods have no effect. Only the XML line

3条回答
  •  花落未央
    2021-02-03 19:20

    I just solved my own problem.

    I totally forgot that it's not the DrawerLayout I want to set the background to, but the ListView inside.

    I admit I made it somewhat hard for you guys without adding code to my post -.-'

    So instead of:

    private DrawerLayout mDrawerLayout;
    (...)
    mDrawerLayout.setBackgroundResource(int);
    

    I had to do this:

    private ListView mDrawerList;
    (...)
    mDrawerList.setBackgroundResource(int);
    

提交回复
热议问题