以编程方式更改系统显示大小Android N.

以编程方式更改系统显示大小Android N.,第1张

概述背景:除了之前提供的更改字体大小功能外, Android N还具有从设置更改系统显示大小的功能. 更改显示尺寸: 图像来源:pcmag.com 题: 如果应用程序具有更改设置的android.permission.WRITE_SETTINGS权限,则可以通过编程方式更改系统字体大小,如How to programmatically change font settings of Device: f 背景:除了之前提供的@R_20_6502@大小功能外,Android N还具有从设置更改系统显示大小的功能.

更改显示尺寸:

@L_404_1@

图像来源:pcmag.com

题:

如果应用程序具有更改设置的androID.permission.WRITE_SETTINGS权限,则可以通过编程方式更改系统字体大小,如How to programmatically change font settings of Device: font style and font size?中所述.但是,我无法找到以编程方式更改显示大小的方法.可能吗?

我试过了什么?

我已经检查了Settings.System便利功能列表中的可能选项,这些功能是以编程方式更改设置而提供的.

更新:

我在这里打开了一个功能请求:https://code.google.com/p/android/issues/detail?id=214124.如果你觉得它会有用,那就明星吧.

感谢您的帮助!

解决方法 在引用 Settings.System时,有一个[putConfiguration(ContentResolver cr,Configuration config)]( https://developer.android.com/reference/android/provider/Settings.System.html#putConfiguration(android.content.ContentResolver,androID.content.res.Configuration))方法.
使用此方法是:

ConvenIEnce function to write a batch of configuration-related settings from a Configuration object.

在Configuration

This includes both user-specifIEd configuration options (locale List and scaling) as well as device configurations (such as input modes,screen size and screen orIEntation).

使用屏幕大小的SCREENLAYOUT_SIZE_MASK 值设置配置.
它是:

The SCREENLAYOUT_SIZE_MASK bits define the overall size of the screen. They may be one of 07004,07005,07006,or 07007.

我希望它可以帮助你.

总结

以上是内存溢出为你收集整理的以编程方式更改系统显示大小Android N.全部内容,希望文章能够帮你解决以编程方式更改系统显示大小Android N.所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1135669.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-30
下一篇2022-05-30

发表评论

登录后才能评论

评论列表(0条)

    保存