File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
composeApp/src/androidMain/kotlin/top/yukonga/miuix/uitest Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,14 @@ class MainActivity : ComponentActivity() {
1818 override fun onCreate (savedInstanceState : Bundle ? ) {
1919 super .onCreate(savedInstanceState)
2020
21+ // Fix display scaling issue on some devices, such as Xiaomi 15 / Xiaomi 15 Pro
22+ val metrics = resources.displayMetrics
23+ val density = metrics.density
24+ val targetDensity = Math .round(density)
25+ metrics.density = targetDensity.toFloat()
26+ metrics.densityDpi = targetDensity * 160
27+ resources.displayMetrics.setTo(metrics)
28+
2129 setContent {
2230 val colorMode = remember { mutableIntStateOf(0 ) }
2331 val darkMode = colorMode.intValue == 2 || (isSystemInDarkTheme() && colorMode.intValue == 0 )
You can’t perform that action at this time.
0 commit comments