Compose Multiplatform 中状态栏颜色更改

问题描述 投票:0回答:1

enter image description here

我想更改状态栏颜色。我在 App.kt 文件 MaterialTheme{ 中尝试了一些代码 } 但不影响状态栏颜色。

我想更改状态栏颜色,例如登录屏幕的背景。并确保它也不会影响 ios。我尝试了edgeToedge()。但它隐藏了状态栏。我不想隐藏状态栏。只是想改变浅色模式或深色模式下的颜色。

android-jetpack-compose kotlin-multiplatform shared compose-multiplatform compose-multiplatform-ios
1个回答
0
投票

我没有太多使用 compose multiplatform,但我会将此行添加到 android Activity

        WindowCompat.setDecorFitsSystemWindows(window, false)

这将使您能够完全访问屏幕。然后,对于 Android 设备上的底部导航,您可能需要添加:

        Modifier.windowInsetsPadding(WindowInsets.navigationBars),

您将传递给您的主要可组合项。

© www.soinside.com 2019 - 2024. All rights reserved.