I'm using Android navigation jetpack library with BottomNavigationView. I have implemented the NavHost, the NavGraph and my fragments. Everything is working as intented when I use actions to navigate.
我使用以下代码设置所有内容:
val navController = Navigation.findNavController(this, R.id.nav_host)
bottom_navigation.setupWithNavController(navController)
问题是,如果我点击一个标签2次,片段就会被重新创建两次.有没有办法拦截导航?我不想导航到正在显示的同一个片段.