Hamburger Icon does not show in Navigation Drawer Fragment

妖精的绣舞 提交于 2019-12-03 07:11:37
MaximusJohnsonus

I had this problem as well. For me, importing android.support.v7.app.ActionBarDrawerToggle instead of android.support.v4.app.ActionBarDrawerToggle fixed it. You also have to remove the R.drawable.ic_drawer argument when you define mDrawerToggle:

mDrawerToggle = new ActionBarDrawerToggle( getActivity(), mDrawerLayout, R.string.navigation_drawer_open, R.string.navigation_drawer_close )

If that doesn't work, try some of the answers to this question.

The accepted answer was not solving it for me, I found out I had the wrong override for onPostCreate

@Override
public void onPostCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
    super.onPostCreate(savedInstanceState, persistentState);
    mDrawerToggle.syncState();
}

It must be

@Override
public void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    mDrawerToggle.syncState();
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!