We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Following information can help us to resolve the issue faster.
In addition, we do not accept issues unrelated to Fragmentation.
The text was updated successfully, but these errors were encountered:
建议对照demo检查一下代码,我在使用没有出现这样的问题。如果解决不了,把问题代码push上来,我帮你看看
Sorry, something went wrong.
MainActivity里的代码 @OverRide protected void onCreate(@nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (findFragment(MainFragment.class) == null) { loadRootFragment(R.id.main_container, MainFragment.newInstance(message)); }
}
MainFragment里的代码 @OverRide public void onActivityCreated(@nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); Log.d(TAG, "onActivityCreated: "); SupportFragment firstFragment = findChildFragment(HomeFragment.class); if (firstFragment == null) { mFragments[FIRST] = HomeFragment.newInstance(); mFragments[SECOND] = RankingFragment.newInstance(); mFragments[THIRD] = DFragment.newInstance(); mFragments[FOURTH] = SortMainFragment.newInstance(); mFragments[FIVE] = ManageTabFragment.newInstance();
loadMultipleRootFragment(R.id.fl_container, FIRST, mFragments[FIRST], mFragments[SECOND], mFragments[THIRD], mFragments[FOURTH], mFragments[FIVE]); mNavigationController.setSelect(SELECTED_FIRST); } else { // 这里库已经做了Fragment恢复,所有不需要额外的处理了, 不会出现重叠问题 // 这里我们需要拿到mFragments的引用 mFragments[FIRST] = firstFragment; mFragments[SECOND] = findChildFragment(RankingFragment.class); mFragments[THIRD] = findChildFragment(DFragment.class); mFragments[FOURTH] = findChildFragment(SortMainFragment.class); mFragments[FIVE] = findChildFragment(ManageTabFragment.class); } }
用navigationController切换fragment mNavigationController = builder.build(); mNavigationController.addSimpleTabItemSelectedListener(new SimpleTabItemSelectedListener() { @OverRide public void onSelected(int index, int old) { showHideFragment(mFragments[index], mFragments[old]); } });
你确定是这段代码的问题吗???我的意思是建议你把包含问题代码的项目,push到上来,我clone,帮你调试看看。
因为是工作上的代码,所以不方便push。大佬,我先在发现当我选择默认显示某个子fragment时才会出现这个问题(其他的界面不会),这个界面的网络请求较复杂一点,会不会是这个子项的问题
No branches or pull requests
Issues Guideline
Following information can help us to resolve the issue faster.
In addition, we do not accept issues unrelated to Fragmentation.
The text was updated successfully, but these errors were encountered: