![](/img/trans.png)
[英]Popping off screen (from “back stack”) represented by a composable to go back to previous screen while using navigation component of Jetpack Compose?
[英]Is there any way to override the back stack button to go back to a screen with its index in jetpack compose?
有沒有辦法將 onBackPress 覆蓋到 go 回到帶有噴氣背包組合索引的屏幕? 例如,go 返回上一屏。
您可以使用后處理程序 function;
BackHandler(
enabled = //condition if you want.
) {
// Navigate where ever you want.
//Example;
navController.navigate(
route = navController.backQueue[i].destination.route.toString()
)
}
在這種情況下,您可以使用自定義 BackHandler。
BackHandler(
enabled = true,
onBack = {navController.navigate(route)}
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.