How to set navigation drawer in preferenceActivity

拟墨画扇 提交于 2019-12-02 09:56:12

In your activity's lowest hiearchical layout (content_main by default), add a FrameLayout named fragment_container. Set width and height to match_parent. Trick here is to create your fragment as this:

getFragmentManager()
.beginTransaction()                           
.replace(R.id.fragment_container, new MyFragment())
.commit();

So you basically don't add a fragment to the screen, you just replace a pre-defined layout with a fragment. This prevents the issues regarding the drawer and toolbar. If not, let me know so I can investigate further.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!