简体   繁体   English

导航抽屉中缺少操作栏

[英]Action Bar missing in Navigation Drawer

I have been working on Navigation Drawer. 我一直在研究导航抽屉。 But my getActionBar() is getting caught in NullPointerException. 但是我的getActionBar()陷入了NullPointerException。 On surrounding it with try and catch, the ActionBar becomes invisible. 通过尝试和捕获将其包围时,ActionBar变为不可见。 Any suggestion how to fix it? 有什么建议如何解决吗?

Put getWindow().requestFeature(Window.FEATURE_ACTION_BAR); 放入getWindow().requestFeature(Window.FEATURE_ACTION_BAR); above your R.layout line. 在您的R.layout线上方。 Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM