小编eHe*_*ero的帖子

将参数传递给 Jetpack Compose 中的嵌套导航图

文档中,我看到您可以像这样嵌套导航图:

NavHost(navController, startDestination = "home") {
    ...
    // Navigating to the graph via its route ('login') automatically
    // navigates to the graph's start destination - 'username'
    // therefore encapsulating the graph's internal routing logic
    navigation(startDestination = "username", route = "login") {
        composable("username") { ... }
        composable("password") { ... }
        composable("registration") { ... }
    }
    ...
}
Run Code Online (Sandbox Code Playgroud)

我想知道,如何在路线中传递参数,并使其可供导航图中的所有可组合项使用?

这是我当前的导航图:

navigation(
    // I'd like to grab this parameter
    route = "dashboard?classId={classId}",
    startDestination = Route.ScreenOne.route) {
    composable(Route.ScreenOne.route) {
        // And then …
Run Code Online (Sandbox Code Playgroud)

android android-jetpack-compose jetpack-compose-navigation

9
推荐指数
2
解决办法
3951
查看次数

Android ObjectAnimator 在选项后填充?

在我的 android 应用程序中,我使用 ObjectAnimator 来转换图像视图,如下所示:

ObjectAnimator transitionX = ObjectAnimator.ofFloat(v, "TranslationY", 190);
Run Code Online (Sandbox Code Playgroud)

在动画完成后,是否有像 fillAfter 这样的选项会将视图的位置重置为新位置?

java animation android

4
推荐指数
1
解决办法
8896
查看次数