public void addFragmentToStack(int containerViewId, Fragment fragment) {
if (mCurrentFragment != null) {
getSupportFragmentManager().beginTransaction()
.detach(mCurrentFragment)
.replace(containerViewId, fragment)
.attach(fragment).addToBackStack(null).commit();
} else {
FragmentTransaction ft = getSupportFragmentManager()
// 设置动画效果
ft.replace(containerViewId, fragment);
ft.commit();
}
mCurrentFragment = fragment;
}