mid*_*ght 8 android android-layout android-fragments
是否有包含片段设置布局的可见度之间的任何主要区别GONE和fragmentTransaction.hide(fragment)除了addToBackStack?
fragmentTransaction.hide(fragment) 不
public void hideFragment(Fragment fragment, int transition, int transitionStyle) {
if (DEBUG) Log.v(TAG, "hide: " + fragment);
if (!fragment.mHidden) {
fragment.mHidden = true;
if (fragment.mView != null) {
Animator anim = loadAnimator(fragment, transition, true,
transitionStyle);
if (anim != null) {
anim.setTarget(fragment.mView);
// Delay the actual hide operation until the animation finishes, otherwise
// the fragment will just immediately disappear
final Fragment finalFragment = fragment;
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (finalFragment.mView != null) {
finalFragment.mView.setVisibility(View.GONE);
}
}
});
anim.start();
} else {
fragment.mView.setVisibility(View.GONE);
}
}
if (fragment.mAdded && fragment.mHasMenu && fragment.mMenuVisible) {
mNeedMenuInvalidate = true;
}
fragment.onHiddenChanged(true);
}
}
Run Code Online (Sandbox Code Playgroud)
所以它确实几乎相同,但它
View返回的from设置Fragment#onCreateView()为GONE而不是容器| 归档时间: |
|
| 查看次数: |
4174 次 |
| 最近记录: |