Set Background Color of Navigation Drawer

前端 未结 3 1935
无人共我
无人共我 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:17

    cast your navigation drawer to navigationView and do as follows

     navigationView.setBackgroundColor(getResources().getColor(R.color.colorPrimaryDark));
    

提交回复
热议问题