Я думаю, что Stack Layout поможет вам. Как это
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MainContainer()
}
}
}
@Preview
@Composable
fun MainContainer() {
Stack {
Align(Alignment.TopCenter) {
Column(arrangement = Arrangement.Center) {
Container(
background(Color.Green),
alignment = Alignment.TopCenter,
//height = 350.dp,
width = 450.dp,
expanded = true
) {
Text("Up")
}
}
}
Align(alignment = Alignment.BottomCenter) {
Column(background(Color.Yellow), arrangement = Arrangement.Center) {
Container(alignment = Alignment.Center, height = 350.dp, width = 450.dp) {
Text("Down")
}
}
}
Align(Alignment.Center) {
Column(background(Color.White), arrangement = Arrangement.Center) {
Container(alignment = Alignment.Center, height = 250.dp, width = 250.dp) {
Clip(shape = RoundedCornerShape(8.dp)) {
LoginContainer()
}
}
}
}
}
}
@Composable
fun LoginContainer() {
Column {
Text("Username")
Text("Password")
Button("Login")
}
}