Android @Compose将如何处理Android中的屏幕尺寸和方向。 谷歌搜索后找不到合适的答案。有人可以回答这个问题吗?
答案 0 :(得分:0)
您可以像这样检查方向:
val configuration = LocalConfiguration.current
when(configuration.orientation) {
Configuration.ORIENTATION_LANDSCAPE -> {}
Configuration.ORIENTATION_PORTRAIT -> {}
Configuration.ORIENTATION_SQUARE -> {}
Configuration.ORIENTATION_UNDEFINED -> {}
}
对于屏幕尺寸:
BoxWithConstraints() {
// thats what you can access:
this.maxWidth
this.maxHeight
this.minWidth
this.minHeight
}