NullPointerException with android.support.v7.widget.Toolbar

后端 未结 12 974
旧巷少年郎
旧巷少年郎 2021-01-07 17:53

I am currently trying to implement a navigation drawer in my app. I am having an issue with the Toolbar being null. I have done many searches online and tried many different

12条回答
  •  庸人自扰
    2021-01-07 18:12

    Set the id attribute in the Toolbar xml like this:

    
    
    
    

    Then remove it from the include block so it looks like this:

    
    

    And to simplify further you could just remove the include block completely and simply insert the Toolbar directly into the xml where the include was.

提交回复
热议问题