Android:Drawerlayout中back键直接退出的问题
Called when the activity has detected the user's press of the back key. The default implementation simply finishes the current activity, but you can override this to do whatever you want.
@Override
public void onBackPressed() {
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
if (mDrawerLayout.isDrawerOpen(findViewById(R.id.left_drawer)))
mDrawerLayout.closeDrawers();
else
super.onBackPressed();
}即检测到侧滑菜单打开的情况则关闭菜单,否则调用父类的onBackPressed方法。
2579



被折叠的 条评论
为什么被折叠?



