我正在尝试使用以下代码更改设备的显示尺寸,但无法正常工作
val config = Configuration()
config.densityDpi = DisplayMetrics.DENSITY_LOW
val customConfigWasSet = System.putConfiguration(contentResolver, config)
但是fontScale
属性因更改而受到好评。
config.fontScale = 0.7f //30% smaller
和Scree Brightness
val brightnessWasSet = System.putInt(contentResolver, System.SCREEN_BRIGHTNESS, 50)
上找到完整的示例
问题:
为什么android.content.res.Configuration#densityDpi
属性在进行更改时会向公众公开,但不被接受。还是有其他方法可以更改设备的显示尺寸。
我尝试过的事情: 我搜索了官方文档,但没有运气,而是在Android Issue Tracker上找到了filed issue。
参考: