Drawer toggle button not displaying on Action Bar

前端 未结 2 727
后悔当初
后悔当初 2021-01-27 20:02

I have two activities in my app and both have navigation drawers implemented. Now the scenario is that the Drawer toggle is getting displayed for the first activity but for the

相关标签:
2条回答
  • 2021-01-27 20:30

    You have to get your Toolbar and set the support action bar like that

    setSupportActionBar(toolbar);
    
    0 讨论(0)
  • 2021-01-27 20:32

    Ok after struggling for 2 days I finally found what the problem was. drum rolls please ....

    The problem was : Z INDEX OF THE CUSTOM ACTION BAR LAYOUT INSIDE DRAWER LAYOUT.

    You heard it .. if you are facing similar issues like for example your custom action bar layout is not displaying or your drawer toggle button is not displaying the first thing you should check if your action bar layout is placed down below all your main layouts to increase its z order.

    In my case I placed it above my main layouts in the drawer layout. And the funny thing is Android Studio's preview window was still displaying the custom action bar as if it doesn't even care about the z index.

    0 讨论(0)
提交回复
热议问题