@Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // detach/attach can lead to view recreate frequently if (mRootView == null || mRootView.get() == null) { View view= initView(); mRootView = new WeakReference<View>(view); } else { ViewGroup parent = (ViewGroup) mRootView.get().getParent(); if (parent != null) { parent.removeView(mRootView.get()); } } return mRootView.get(); }
Android软引用保存Ui数据....
最新推荐文章于 2024-07-25 19:04:18 发布