Navigation Drawer icon not showing android

家住魔仙堡 提交于 2019-12-03 17:24:30
Sagar Maiyad

I solved my problem by replacing:

actionBar.setDisplayShowCustomEnabled(true);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayUseLogoEnabled(false);
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setHomeButtonEnabled(true);
actionBar.setIcon(null);

with:

actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
actionBar.setIcon(android.R.color.transparent);

More correct answer is this.

As per warning from log,

W/ActionBarDrawerToggle(28554): DrawerToggle may not show up because Navigation Icon is not visible. You may need to call actionbar.setDisplayHomeAsUpEnabled(true);

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