Android 使用 adb wm 命令调整手机分辨率

Android adb About 1,933 words

wm 命令修改屏幕的参数

wmWindowManager

adb shell wm
或进入shell模式后直接输入wm

输出:

usage: wm [subcommand] [options]
       wm size [reset|WxH|WdpxHdp]
       wm density [reset|DENSITY]
       wm overscan [reset|LEFT,TOP,RIGHT,BOTTOM]
       wm scaling [off|auto]
       wm screen-capture [userId] [true|false]

wm size: return or override display size.
         width and height in pixels unless suffixed with 'dp'.

wm density: override display density.

wm overscan: set overscan area for display.

wm scaling: set display scaling mode.

wm screen-capture: enable/disable screen capture.

wm dismiss-keyguard: dismiss the keyguard, prompting the user for auth if necessary.

如报错:

java.lang.SecurityException: Must hold permission android.permission.WRITE_SECURE_SETTINGS
        at android.os.Parcel.readException(Parcel.java:1599)
        at android.os.Parcel.readException(Parcel.java:1552)
        at android.view.IWindowManager$Stub$Proxy.setForcedDisplaySize(IWindowManager.java:1308)
        at com.android.commands.wm.Wm.runDisplaySize(Wm.java:164)
        at com.android.commands.wm.Wm.onRun(Wm.java:87)
        at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
        at com.android.commands.wm.Wm.main(Wm.java:46)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:357)

在开发者选项中打开USB调试(安全设置)

wm size

查询和修改当前设备的尺寸,使用x(xyz的x)进行连接。

查询设备尺寸

wm size

输出:

Physical size: 1080x1920

修改设备尺寸

wm size 720x1280

修改后设备尺寸:

Physical size: 1080x1920
Override size: 720x1280

还原设备尺寸

wm size reset

wm density

查看和修改当前设备的density参数。

查询设备 density

wm density

输出:

Physical density: 480

修改设备 density

wm density 420

修改后设备density

Physical density: 480
Override density: 420

还原设备 density

wm density reset

wm overscan

修改当前设备的屏幕内边距,左上右下顺序

修改屏幕内边距

wm overscan 20,20,20,20

还原屏幕内边距

wm overscan reset

常用的设备参数

  • 480,1080x1920
  • 460,1080x1920
  • 320,720x1280
  • 560,1440x2392
Views: 31,404 · Posted: 2019-04-09

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh