当调用FragmentTransaction#hide(fragment)
和FragmentTransaction#show(fragment)
方法, fragment不会调用生命周期方法onResume
和onPause()
Fragment的onResume和onPause调用时机与Activity相同
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
if (hidden) {
// getSupportFragmentManager().beginTransaction().hide(fragment);
onPause();
} else {
// getSupportFragmentManager().beginTransaction().show(fragment);
onResume();
}
}