当我写下这段代码时:
val widthScreenDp = LocalConfiguration.current.screenWidthDp
val heightScreenDp = LocalConfiguration.current.screenHeightDp
val widthScreenPx = with(LocalDensity.current) { widthScreenDp.dp.toPx() }
val heightScreenPx = with(LocalDensity.current) { heightScreenDp.dp.toPx() }
对于我的小米10手机,结果是1078 x 2117.5而不是1080 x 2340。对于Pixel5模拟器,结果为1078 x 2062...
问题出在哪里?如何在Jetpack Compose中获得设备的完整尺寸?
看起来似乎缺少状态栏/导航栏的高度。
谢谢!