我想使用 Jetpack Compose 的 Nav Host 的深层链接,并按照 Compose Navigation 上的此页面进行操作: https: //developer.android.com/jetpack/compose/navigation#deeplinks
我的实现:AndroidManifest.xml:
<application ...>
<activity
...
android:allowTaskReparenting="true"
android:launchMode="singleInstance">
...
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="xkcd.com" />
<data android:scheme="https" android:host="www.xkcd.com" />
</intent-filter>
</activity>
</application>
Run Code Online (Sandbox Code Playgroud)
MainActivity.onCreate().setContent{}
val rootUri = "https://www.xkcd.com"
NavHost(navController = navController, startDestination = "mainView") {
composable("mainView", deepLinks = listOf(navDeepLink { uriPattern = rootUri })) {
MainContent()
}
composable(
route = "singleView/{number}",
arguments = listOf(navArgument("number") { type = NavType.IntType }),
deepLinks = listOf(navDeepLink …Run Code Online (Sandbox Code Playgroud) android android-deep-link android-jetpack-navigation android-jetpack-compose
撰写文档中解释的默认缩放行为会干扰拖动手势,并围绕可缩放的中心而不是手指旋转和缩放
有一个更好的方法吗?