FragmentTransaction transaction = getSupportFragmentManager()
.beginTransaction();
transaction.addToBackStack(null);
//第一二个参数是进入动画 后面2个是返回动画
transaction.setCustomAnimations(0, 0, R.anim.push_right_in,
R.anim.push_right_out);
// transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
transaction.replace(R.id.content_frame, fragment).commit();
转载于:https://my.oschina.net/liyang2l/blog/159050