📌  相关文章
📜  Android Navigation 组件以编程方式清除回栈 - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:25.358000             🧑  作者: Mango

代码示例1
override fun onBackPressed() {
   val navigationController = binding.navigation.findNavController()
     if (navigationController.currentDestination?.id == R.id.homeFragment) {
         finish()
     } else {
         super.onBackPressed()
       }
}