Home键没有显示在导航抽屉最多的android [英] Home button not showing up in navigation drawer android
本文介绍了Home键没有显示在导航抽屉最多的android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用抽屉式导航
为一个项目,一切工作正常,但一个小问题,我始终是箭头
显示没有首页
按钮。
我试图在文档,论坛,发现一切都在这里没有什么实际工作。
我试过到目前为止:
mDrawerToggle.syncState();
actionBar.setDisplayShowTitleEnabled(真);
actionBar.setDisplayHomeAsUpEnabled(真);
@覆盖
公共无效onPostCreate(捆绑savedInstanceState,PersistableBundle persistentState){
super.onPostCreate(savedInstanceState,persistentState);
。mNavigationDrawerFragment.getmDrawerToggle()syncState();
}动作条动作条= getSupportActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
actionBar.setDisplayShowTitleEnabled(真);
actionBar.setDisplayHomeAsUpEnabled(真);
actionBar.setHomeButtonEnabled(真);
actionBar.setTitle(mTitle);
NavigationDrawerFragment:
//推迟code依赖于previous实例状态的恢复。
mDrawerLayout.post(新的Runnable(){
@覆盖
公共无效的run(){
mDrawerToggle.syncState();
}
});
解决方案
所以,我终于找到了解决办法。我只是把这个 R.drawable.ic_drawer
从:
drawerToggle =新ActionBarDrawerToggle(getActivity(),drawerLayout,R.drawable.ic_drawer,R.string.open,R.string.close);
和它的工作就像一个魅力。
I'm using navigation drawer
for a project, everything is working fine but one small problem, I always that arrow
displayed not home
button.
I tried everything found in the documentations, forums and here nothing is actually working.
What I tried so far:
mDrawerToggle.syncState();
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
@Override
public void onPostCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
super.onPostCreate(savedInstanceState, persistentState);
mNavigationDrawerFragment.getmDrawerToggle().syncState();
}
ActionBar actionBar = getSupportActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
actionBar.setTitle(mTitle);
NavigationDrawerFragment:
// Defer code dependent on restoration of previous instance state.
mDrawerLayout.post(new Runnable() {
@Override
public void run() {
mDrawerToggle.syncState();
}
});
解决方案
So I finally found the solution. I just took of this R.drawable.ic_drawer
from:
drawerToggle = new ActionBarDrawerToggle(getActivity(), drawerLayout, R.drawable.ic_drawer, R.string.open, R.string.close);
And it worked like a charm.
这篇关于Home键没有显示在导航抽屉最多的android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文