现在,我尝试了androidX的导航和底部导航栏,当我像下面这样使用它时
supportFragmentManager = getSupportFragmentManager();
navHostFragment =(NavHostFragment)supportFragmentManager.findFragmentById(R.id.frag_nav);
navController = navHostFragment.getNavController();
NavigationUI.setupWithNavController(navigation, navController);
发现一个问题,每次切换bottomNavigationBar,fragment会重新创建,目标fragment中的所有网络任务都会重做,androidX切换时如何保持fragment的状态?