how to resize physical android screen from terminal/shell
Asked Answered
H

3

32

A while ago, I was able to resize the screens on Android. For example, I had a Xoom, and was able to run a command from ADB which shrunk it down to a 7" screen (leaving a black border around it). Granted, it was a little buggy because the home/back/app-switch buttons disappeared, but I know it's possible. It's a 1 line command where I input the new screen resolution in X and Y pixels for the Xoom.

I was wondering if anyone was familiar with this, and knows how to do it.

(and if anyone says it's not possible, I can assure you it is)

(and I want to do this so I can test apps in various screen sizes on my Nexus 10, and I'd prefer not using an emulator)

Henleigh answered 19/11, 2012 at 9:48 Comment(1)
Another use for that is when you have your screen cracked on one side corner, with 80% working touches. You can resize it then and have working screen again ;)Spandrel
S
25

I believe it is:

adb shell am display-size 

but i am away from a computer to try it. An example use would be:

adb shell am display-size 640x480
Saxena answered 19/11, 2012 at 15:24 Comment(3)
To reset the screen size use adb shell am display-size reset.Transarctic
Is the way to stretch that piece of screen to full size? I have 9.7 Retina 2048x1536 and I prefer to change resolution to 1024x768 but have only a piece of screen in left upper corner...Deshabille
I get error /system/bin/sh: wm: not found. Why? look at my question in https://mcmap.net/q/392146/-error-on-running-quot-adb-shell-wm-density-240-quot-for-changing-android-device-density/779408Goggin
K
63

An update to this answer for Jelly Bean 4.3 from Android dev Adam Powell on Google+ (link found via this SO answer):

In Android 4.3 these options moved from the "am" command (ActivityManager) to the "wm" command (WindowManager). Type "adb shell wm" for details.

So you can now run on 4.3 devices:

adb shell wm size 1280x800 or whatever size or reset

and

adb shell wm density 480 or whatever density or reset

Just make sure the screen is not currently displaying at the moment you run the command.

Kramlich answered 3/9, 2013 at 21:0 Comment(4)
Any way to set this as a property in /system/build.prop?Heroics
@Paul Harris has anyone been able to change the size/density and still show the back button? Is there another command that forces it to show? Also, when I do a reset, the back button is only visible in portrait mode?Hydromel
I get error /system/bin/sh: wm: not found. Why? please look at my question in https://mcmap.net/q/392146/-error-on-running-quot-adb-shell-wm-density-240-quot-for-changing-android-device-density/779408Goggin
Is there any way to call this from Android code at runtime?Endothelium
S
25

I believe it is:

adb shell am display-size 

but i am away from a computer to try it. An example use would be:

adb shell am display-size 640x480
Saxena answered 19/11, 2012 at 15:24 Comment(3)
To reset the screen size use adb shell am display-size reset.Transarctic
Is the way to stretch that piece of screen to full size? I have 9.7 Retina 2048x1536 and I prefer to change resolution to 1024x768 but have only a piece of screen in left upper corner...Deshabille
I get error /system/bin/sh: wm: not found. Why? look at my question in https://mcmap.net/q/392146/-error-on-running-quot-adb-shell-wm-density-240-quot-for-changing-android-device-density/779408Goggin
S
2

you can also change the resolution via android terminal, just type "wm size 720x1280" for example.

Sticker answered 1/11, 2022 at 23:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.