简体   繁体   English

如何在 jetpack compose 中更改对话框 window 中的填充?

[英]how to change paddings in dialog window in jetpack compose?

I need to write a composable function that, like a dialog window, will be displayed over the rest of the screen elements.我需要编写一个可组合的 function ,就像对话框 window 一样,将显示在屏幕元素的 rest 上。 I wrap the contents of my composable function in Dialog().我将可组合 function 的内容包装在 Dialog() 中。 But there are paddings on all sides of the screen.但是屏幕的四面都有填充物。 How can they be removed?如何将它们移除?

screenshot of problem , red lines are paddings that need to be removed问题截图,红线是需要移除的填充

I use dialog in my function something like this:我在 function 中使用对话框,如下所示:

@Composable
fun MyFunction(){
  Dialog(onDismissRequest = { }) {
    //content
  }
}

You can do this:你可以这样做:

        @Composable
        fun MyFunction(){
        Dialog(onDismissRequest = { },
        properties = DialogProperties(usePlatformDefaultWidth = false)) {
        Box(modifier = Modifier.fillMaxSize()) {
        //content
      }
    }
  }

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM