我可以从工具栏中删除汉堡包(抽屉导航图标),删除它的区域(矩形)吗?

Can I remove the Hamburger (drawer navigation icon) from the toolbar, removing the area of it (rectangle)?

我想删除汉堡包和它的矩形区域,但我做不到。

很多答案都说使用 "setDrawerIndicatorEnabled(false)",但我认为这不是我想要的,或者如果是,我没有正确使用。

When the indicator is disabled, the ActionBar will revert to displaying the home-as-up indicator provided by the Activity's theme in the android.R.attr.homeAsUpIndicator attribute instead of the animated drawer glyph.

问题是,我想删除它,而不仅仅是显示导航箭头。

ActionBarDrawerToggle 的唯一目的是通过单击启用该按钮 open/close DrawerLayout 的抽屉。如果您不需要该功能,您可以删除 ActionBarDrawerToggle。用户仍然可以像往常一样拖动抽屉,您仍然可以使用适当的 DrawerLayout#openDrawer()DrawerLayout#closeDrawer*() 方法以编程方式 open/close 它。

如果您还使用了另一种启用 navigation/up 按钮的方法 - 例如 ActionBar#setDisplayHomeAsUpEnabled()Toolbar#setNavigationIcon() - 您也需要将其删除,以完全摆脱按钮。