更新时间:2022-06-26 07:27:25
我也遇到了这个问题,假设您已经按照@Kernald 的建议有一个 ActionBarDrawerToggle,您还需要将以下内容添加到您的 Activity:
I ran into this issue also, assuming you already have an ActionBarDrawerToggle as @Kernald suggested, you need to add the following also to your Activity:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Pass the event to ActionBarDrawerToggle, if it returns
// true, then it has handled the app icon touch event
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
// Handle your other action bar items...
return super.onOptionsItemSelected(item);
}
这让我们切换手柄按下操作栏上的图标按钮,导致抽屉滑出.
This let's the toggle handle the icon button press on the ActionBar, causing the Drawer to slide out.