简体   繁体   English

如何将按钮放在 Jetpack Compose 的最右上角

[英]how to put button in top right most corner in jetpack compose

I do not know how to put button at top right most corner of the screen in jetpack compose.Please help me with the code?我不知道如何在 Jetpack Compose 中将按钮放在屏幕的最右上角。请帮我提供代码?

I have added button but it is showing at the centre of the screen我添加了按钮,但它显示在屏幕中央

Can you try this?你能试试这个吗?

@Composable
fun MyScreen() {
    Box(
        modifier = Modifier.fillMaxSize()
    ){
        Button(
            modifier = Modifier.align(Alignment.TopEnd),
            onClick = {}
        ) {
            Text("A Button")
        }
    }
}

在此处输入图像描述

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

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