带有禁用抽屉指示器的抽屉布局仅显示不工作箭头

Drawerlayout with disabled drawerindicator shows only not working arrow

我正在使用 android 中的导航抽屉布局在屏幕右侧的滑动菜单中显示过滤器。

现在我想删除工具栏中的左侧图标。我这样做如下:

mDrawerToggle.setDrawerIndicatorEnabled(false);
mDrawerToggle.syncState();

我现在面临的唯一问题是图标是一个箭头,它什么也没做,我希望它仍然有向上的行为。

我试过这样的事情:

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.action_filter:
            Timber.d("Open or close filter");
            mNavigationDrawerFragment.openDrawer();
            return true;
        case android.R.id.home:
            NavUtils.navigateUpFromSameTask(this);
            return true;
    }
    return super.onOptionsItemSelected(item);
}

但这不起作用,因为没有为那个箭头调用 onOptionsItemSelected?

有人有想法吗?

尝试:

  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setDisplayShowHomeEnabled(true);