sud*_*shu 8 android android-jetpack-compose
Android @Compose 将如何处理 Android 中的屏幕尺寸和方向。谷歌搜索后我无法找到合适的答案。有人可以回答这个问题吗。
您可以这样检查方向:
val configuration = LocalConfiguration.current
when(configuration.orientation) {
Configuration.ORIENTATION_LANDSCAPE -> {}
Configuration.ORIENTATION_PORTRAIT -> {}
Configuration.ORIENTATION_SQUARE -> {}
Configuration.ORIENTATION_UNDEFINED -> {}
}
Run Code Online (Sandbox Code Playgroud)
对于屏幕尺寸:
BoxWithConstraints() {
// thats what you can access:
this.maxWidth
this.maxHeight
this.minWidth
this.minHeight
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9989 次 |
| 最近记录: |