我曾试图找到任何有关这种文件,但又找不到任何东西,我尝试采用台式堆肥方法,但没有uck,如果任何人在座,能够让我点人知道如何将其归档,我会知道。
@Composable
@Preview
fun mainScreen() {
var xPosition by remember { mutableStateOf(50f) }
Column(
modifier = Modifier
.fillMaxSize()
.background(color = Color.Red)
.onPreviewKeyEvent { event: KeyEvent ->
if (event.type == KeyEventType.KeyDown) {
when (event.key) {
Key.DirectionLeft -> { // Left arrow key
xPosition -= 10f
true
}
Key.DirectionRight -> { // Right arrow key
xPosition += 10f
true
}
else -> false
}
} else false
},
verticalArrangement = Arrangement.Center
) {
Box(
modifier = Modifier
.size(100.dp)
) {
Canvas(modifier = Modifier.fillMaxSize()) {
drawRect(
color = Color.Blue,
topLeft = androidx.compose.ui.geometry.Offset(xPosition, 0f),
size = androidx.compose.ui.geometry.Size(100f, 100f)
)
}
}
}
}