How to get the Android device screen size from the adb command line?

前端 未结 9 1985
故里飘歌
故里飘歌 2020-12-07 10:37

I need a way to detect device screen size and density with adb. If there is no solution, where can I get the complete list of all existing android device with their screen

9条回答
  •  粉色の甜心
    2020-12-07 11:13

    You can also access the WindowManager through ADB:

    $ adb shell wm
    usage: wm [subcommand] [options]
           wm size [reset|WxH]
           wm density [reset|DENSITY]
           wm overscan [reset|LEFT,TOP,RIGHT,BOTTOM]
    

    To get the screen resolution:

    $ adb shell wm size
    Physical size: 2880x1600
    

    To get the screen the density:

    $ adb shell wm density
    Physical density: 320
    

    You can also override the density by adding the new density:

    $ adb shell wm density 160
    

提交回复
热议问题