Пример #1
0
 /** 描述:显示这个fragment */
 public void showFragment(Fragment fragment) {
   // 主视图的Fragment添加
   getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, fragment).commit();
   if (menu.isMenuShowing()) {
     menu.showContent();
   }
 }
 @Override
 public void onBackPressed() {
   if (menu.isMenuShowing()) {
     menu.showContent();
   } else {
     super.onBackPressed();
   }
 }
Пример #3
0
 /** 描述:返回. */
 @Override
 public void onBackPressed() {
   if (menu.isMenuShowing()) {
     menu.showContent();
   } else {
     if (mMainContentFragment.canBack()) {
       if (isExit == false) {
         isExit = true;
         AbToastUtil.showToast(MainActivity.this, "再按一次退出程序");
       } else {
         super.onBackPressed();
       }
     }
   }
 }