Resize system display programmatically Android N

Background . Android N is equipped with a Display Size change function from the settings, in addition to the previously existing Font Size change function.

Resize Screen:

enter image description here

Image Source: pcmag.com

Question

If the application has android.permission.WRITE_SETTINGS permission to change settings, there are ways to change the system font size programmatically, as described in How to programmatically change device font settings: font style and font size? . However, I could not find a way to resize the display programmatically. Is it possible?

What have i tried?

I checked the options in the Settings.System list of convenience functions needed to change the settings programmatically.

Update :

I opened a function request for the same: https://code.google.com/p/android/issues/detail?id=214124 . If you feel this would be helpful, please run it.

Thanks for your help in advance!

+7
android android-settings android-n
source share
1 answer

When accessing Settings.System, there is [ putConfiguration(ContentResolver cr, Configuration config) ] ( https://developer.android.com/reference/android/provider/Settings.System.html#putConfiguration(android.content.ContentResolver , android.content .res.Configuration)). Using this method:

A convenient function for writing a package of parameters related to a configuration from the Configuration object.

In Configuration

This includes both user configuration parameters (list of locales and scaling) and device configurations (such as input mode , screen size, and screen orientation ).

Configure with SCREENLAYOUT_SIZE_MASK screen sizes. It:

The SCREENLAYOUT_SIZE_MASK bits determine the overall screen size. They can be SCREENLAYOUT_SIZE_SMALL , SCREENLAYOUT_SIZE_NORMAL , SCREENLAYOUT_SIZE_LARGE , or SCREENLAYOUT_SIZE_XLARGE .

I hope this helps you.

0
source share

All Articles