Android-更改显示尺寸不起作用

时间:2020-07-14 04:01:52

标签: android kotlin

遵循此issuethis comment

我正在尝试使用以下代码更改设备的显示尺寸,但无法正常工作

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)

您将在this Github repository

上找到完整的示例

问题: 为什么android.content.res.Configuration#densityDpi属性在进行更改时会向公众公开,但不被接受。还是有其他方法可以更改设备的显示尺寸。

我尝试过的事情: 我搜索了官方文档,但没有运气,而是在Android Issue Tracker上找到了filed issue

参考:

0 个答案:

没有答案
相关问题