📅  最后修改于: 2022-03-11 14:52:43.499000             🧑  作者: Mango
private fun adjustFontScale(configuration: Configuration) {
if (configuration.fontScale > 0.90) {
configuration.fontScale = 0.90f
val metrics = resources.displayMetrics
val wm = baseContext.getSystemService(WINDOW_SERVICE) as WindowManager
wm.defaultDisplay.getMetrics(metrics)
metrics.scaledDensity = configuration.fontScale * metrics.density
baseContext.resources.updateConfiguration(configuration, metrics)
}
}