我正在将NavigationComponent与BottomNavigationView一起使用。
[当我使用那样的导航(A-> B-> B1)时,底部导航会自动将他选择的项目从A更改为B。我正在使用默认方法进行导航。
findNavController().navigate(R.id.action_A_to_B)
然后在片段B中再次使用
findNavController().navigate(R.id.action_B_to_B1)
只有这样,我才能获得理想的结果。
[当我尝试使用那样的导航(A-> B1)时,我的底部导航不会将他的选择从A更改为B。
findNavController().navigate(R.id.action_A_to_B1)
导航时,可以通过以下语句以编程方式更改选择:
bottomNavigation.selectedItemId=R.id.itemFragmentB