我正在向操作栏添加自定义视图,但是当我这样做时,导航指示器图标不显示。当我不显示自定义视图时,指示器会显示并且工作正常。
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setHomeButtonEnabled(true);
getActionBar().setBackgroundDrawable(getResources().getDrawable(navConf.getBackgroundDraw()));
if (0 != navConf.getActionBarCustomView()){
getActionBar().setCustomView(navConf.getActionBarCustomView());
getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM
| ActionBar.DISPLAY_SHOW_HOME);
}
try{
mDrawerToggle = new ActionBarDrawerToggle(
this,
mDrawerLayout,
navConf.getDrawerIcon(),
navConf.getDrawerOpenDesc(),
navConf.getDrawerCloseDesc()
) {
public void onDrawerClosed(View view) {
getActionBar().setTitle(mTitle);
ActivityCompat.invalidateOptionsMenu(AbstractNavDrawerActivity.this);
}
public void onDrawerOpened(View drawerView) {
getActionBar().setTitle(mDrawerTitle);
ActivityCompat.invalidateOptionsMenu(AbstractNavDrawerActivity.this);
}
};
}
catch (Exception ex){
Log.e("ActionBarDrawerToggle: ", ex.toString());
}
mDrawerLayout.setDrawerListener(mDrawerToggle);