@Override public void onBackPressed() { if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) {//判断 mDrawerLayout.closeDrawers(); } else { if (System.currentTimeMillis() - exittime < 2000){ super.onBackPressed(); }else { ToastUtil.showToast(MainActivity.this, "再按一次退出", Toast.LENGTH_SHORT); exittime = System.currentTimeMillis(); } }}
抽屉DrawerLayout onBackPressed事件
最新推荐文章于 2022-10-23 21:35:53 发布