且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法使用导航组件清除所有片段的后堆栈

更新时间:2023-12-05 23:03:34

我用 AppBarConfiguration

val appBarConfiguration = AppBarConfiguration
            .Builder(
                    R.id.preLoginFragment,
                    R.id.welcomeFragment
              )
            .build()

然后,您需要调用 setupActionBarWithNavController(this, navController, appBarConfiguration)

这里我声明了两个***片段,其中后退箭头不会显示在应用栏中.

Here I am declaring two top level fragments where the back arrow won't be shown in the app bar.