I can't seem to figure out how to align in Jetpack Compose. Here's what I want it to look:
Now I tried the following, but it does not work as expected: Nevermind the exact colors btw, I'm only really interested in the concept of how to position those views, each rotated 90 degrees, and aligned to the edges of the Tablet in my case
// Large green background
Box(modifier = Modifier.fillMaxSize().background(Color.DarkGray))
{
Box(
Modifier
.fillMaxSize()
.background(Color.Green),
contentAlignment = Alignment.BottomCenter
) { Text("Player 1") }
Box(
Modifier
.fillMaxSize()
.background(Color.Green)
.rotate(90f),
contentAlignment = Alignment.CenterStart
) { Text("Player 2") }
Box(
Modifier
.fillMaxSize()
.background(Color.Green)
.rotate(180f),
contentAlignment = Alignment.TopCenter,
) { Text("Player 3") }
Box(
Modifier
.fillMaxSize()
.background(Color.Green)
.rotate(-90f),
contentAlignment = Alignment.CenterEnd
) { Text("Player 4") }
}
I'm either missing an Align option, or a way to set the Pivot points for the Rotation. Any one has a suggestion?
I'm currently using:
- AS 2020.3.1 - patch 4
- Compose 1.1.0-rc01
- Kotlin 1.6.0
- Agp: 7.0.4