简体   繁体   English

如何让脚手架出现在 Jetpack Compose 的顶部通知栏上?

[英]How to get Scaffold to Appear Over Top Notification Bar in Jetpack Compose?

I want my scaffold to appear over the top of the notification bar, is this possible?我希望我的脚手架出现在通知栏的顶部,这可能吗?

This is what I have (can't show much due to company policy):这就是我所拥有的(由于公司政策,不能显示太多):

在此处输入图像描述

I want the scaffold to go over the time and battery symbol.我想要脚手架到 go 随着时间和电池符号。

This is what I want:这就是我要的:

在此处输入图像描述

The above image is from Google Developers documentation site: https://developer.android.com/jetpack/compose/layouts/material#modal-drawers上图来自 Google Developers 文档站点: https://developer.android.com/jetpack/compose/layouts/material#modal-drawers

My code:我的代码:

Scaffold(
 scaffoldState = scaffoldState,
 topBar = {
  TopBarComposable() // Where you see the Edit button is bottom right
 },
 drawerContent = {
  DrawerContentComposable()
 },
 content = {
  ContentComposable() // The main screen thats under the Top Bar Composable
 },
 bottomBar = { BottomBarComposable() },
 drawerShape = RectangleShape
)

Any help would be greatly appreciated!任何帮助将不胜感激!

Use WindowCompat.setDecorFitsSystemWindows使用WindowCompat.setDecorFitsSystemWindows

// Turn off the decor fitting system windows, which allows us to handle insets, including IME animations
WindowCompat.setDecorFitsSystemWindows(window, false)

Source: Now In Android来源:现在在 Android

Refer here for more details.有关详细信息,请参阅此处

Note, you also have to handle padding manually.请注意,您还必须手动处理填充。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在jetpack compose中将图像添加到脚手架顶部栏 - Adding image to scaffold top bar in jetpack compose 使用脚手架 android 折叠喷气背包中的顶部应用程序栏 - Collapsing top app bar in jetpack compose using scaffold android 从 jetpack 组合导航使用 popBackStack 时如何更改脚手架顶部栏的标题? - How to change title for scaffold top bar when using popBackStack from jetpack compose navigation? 如何使 Jetpack compose 元素出现在 android 的键盘顶部? - How to make a Jetpack compose element appear on top of the keyboard in android? 什么是脚手架? 喷气背包组成 - What is Scaffold? Jetpack compose 在 Scaffold Jetpack Compose 内的特定屏幕上隐藏顶部和底部导航器 - hide Top and Bottom Navigator on a specific screen inside Scaffold Jetpack Compose Jetpack Compose - 无法为脚手架底部栏的高度设置动画 - Jetpack Compose - Cannot animate Scaffold's bottom bar's height Jetpack Compose,如何在 Scaffold 中的 .showSnackbar() 中更改零食栏的动作颜色? - Jetpack Compose, how to change the color of the action of the snackbar in .showSnackbar() in a Scaffold? 如何在 android jetpack compose 中从 Scaffold 隐藏或展开 Topbar - How to hide or expand Topbar from Scaffold in android jetpack compose 如何更改 Jetpack Compose 抽屉内的 Scaffold 内的内容? - How to change the content inside a Scaffold that exists inside drawer in Jetpack Compose?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM