登录

Android adb 获取屏幕分辨率信息

Android
0 93

相信做android开发的朋友在做屏幕适应的时候都需要查查分辨率,其实查分辨率有最快捷的方式,使用ADB命令获取就可以了

打印详细方式: adb shell dumpsys window displays 执行结果: 

AndydeMacBook-Pro:~ andy$ adb shell dumpsys window displays
WINDOW MANAGER DISPLAY CONTENTS (dumpsys window displays)
  Display: mDisplayId=0
    init=720x1280 320dpi cur=720x1280 app=720x1280 rng=720x672-1280x1232
    deferred=false layoutNeeded=true

  Application tokens in top down Z order:
    mStackId=1
    mDeferDetach=false
    mFullscreen=true
    mBounds=[00][7201280]
      taskId=1210
        mFullscreen=true
        mBounds=[00][7201280]
        mdr=false
        appTokens=[AppWindowToken{9a98646 token=Token{5932888 ActivityRecord{37c2b u0 com.android.settings/.Settings t1210}}} AppWindowToken{a6b13b7 token=Token{50e6ab6 ActivityRecord{8a2d251 u0 com.android.settings/.Settings$DevelopmentSettingsActivity t1210}}}]
        mTempInsetBounds=[00][00]
          Activity #1 AppWindowToken{a6b13b7 token=Token{50e6ab6 ActivityRecord{8a2d251 u0 com.android.settings/.Settings$DevelopmentSettingsActivity t1210}}}
          windows=[Window{59d3ab5 u0 com.android.settings/com.android.settings.Settings$DevelopmentSettingsActivity}]
          windowType=2 hidden=false hasVisible=true
          app=true voiceInteraction=false
          allAppWindows=[Window{59d3ab5 u0 com.android.settings/com.android.settings.Settings$DevelopmentSettingsActivity}]
          task={taskId=1210 appTokens=[AppWindowToken{9a98646 token=Token{5932888 ActivityRecord{37c2b u0 com.android.settings/.Settings t1210}}} AppWindowToken{a6b13b7 token=Token{50e6ab6 ActivityRecord{8a2d251 u0 com.android.settings/.Settings$DevelopmentSettingsActivity t1210}}}] mdr=false}
           appFullscreen=true requestedOrientation=-1
          hiddenRequested=false clientHidden=false reportedDrawn=true reportedVisible=true
          numInterestingWindows=1 numDrawnWindows=1 inPendingTransaction=false allDrawn=true (animator=true)
          startingData=null removed=false firstWindowDrawn=true mIsExiting=false
          Activity #0 AppWindowToken{9a98646 token=Token{5932888 ActivityRecord{37c2b u0 com.android.settings/.Settings t1210}}}
          windows=[Window{3a99fa6 u0 com.android.settings/com.android.settings.Settings}]
          windowType=2 hidden=true hasVisible=true
          app=true voiceInteraction=false
          allAppWindows=[Window{3a99fa6 u0 com.android.settings/com.android.settings.Settings}]
          task={taskId=1210 appTokens=[AppWindowToken{9a98646 token=Token{5932888 ActivityRecord{37c2b u0 com.android.settings/.Settings t1210}}} AppWindowToken{a6b13b7 token=Token{50e6ab6 ActivityRecord{8a2d251 u0 com.android.settings/.Settings$DevelopmentSettingsActivity t1210}}}] mdr=false}
           appFullscreen=true requestedOrientation=-1
          hiddenRequested=true clientHidden=true reportedDrawn=false reportedVisible=false
          mAppStopped=true
          numInterestingWindows=1 numDrawnWindows=1 inPendingTransaction=false allDrawn=true (animator=true)
          startingData=null removed=false firstWindowDrawn=true mIsExiting=false
      taskId=1209
        mFullscreen=true
        mBounds=[00][7201280]
        mdr=false
        appTokens=[AppWindowToken{c9fa4f token=Token{36ac129 ActivityRecord{9877eb0 u0 com.soft.nly.gcnextpanel/.activity.PassAllActivity t1209}}}]
        mTempInsetBounds=[00][00]
          Activity #0 AppWindowToken{c9fa4f token=Token{36ac129 ActivityRecord{9877eb0 u0 com.soft.nly.gcnextpanel/.activity.PassAllActivity t1209}}}
          windows=[Window{e9472a4 u0 com.soft.nly.gcnextpanel/com.soft.nly.gcnextpanel.activity.PassAllActivity}]
          windowType=2 hidden=true hasVisible=true
          app=true voiceInteraction=false
          allAppWindows=[Window{e9472a4 u0 com.soft.nly.gcnextpanel/com.soft.nly.gcnextpanel.activity.PassAllActivity}]
          task={taskId=1209 appTokens=[AppWindowToken{c9fa4f token=Token{36ac129 ActivityRecord{9877eb0 u0 com.soft.nly.gcnextpanel/.activity.PassAllActivity t1209}}}] mdr=false}
           appFullscreen=true requestedOrientation=0
          hiddenRequested=true clientHidden=true reportedDrawn=false reportedVisible=false
          mAppStopped=true
          numInterestingWindows=1 numDrawnWindows=1 inPendingTransaction=false allDrawn=true (animator=true)
          startingData=null removed=false firstWindowDrawn=true mIsExiting=false
    mStackId=0
    mDeferDetach=false
    mFullscreen=true
    mBounds=[00][7201280]
      taskId=1206
        mFullscreen=true
        mBounds=[00][7201280]
        mdr=false
        appTokens=[AppWindowToken{a8af06b token=Token{b09aae5 ActivityRecord{ca549dc u0 com.android.launcher3/.Launcher t1206}}}]
        mTempInsetBounds=[00][00]
          Activity #0 AppWindowToken{a8af06b token=Token{b09aae5 ActivityRecord{ca549dc u0 com.android.launcher3/.Launcher t1206}}}
          windows=[Window{e23cfeb u0 com.android.launcher3/com.android.launcher3.Launcher}]
          windowType=2 hidden=true hasVisible=true
          app=true voiceInteraction=false
          allAppWindows=[Window{e23cfeb u0 com.android.launcher3/com.android.launcher3.Launcher}]
          task={taskId=1206 appTokens=[AppWindowToken{a8af06b token=Token{b09aae5 ActivityRecord{ca549dc u0 com.android.launcher3/.Launcher t1206}}}] mdr=false}
           appFullscreen=true requestedOrientation=5
          hiddenRequested=true clientHidden=true reportedDrawn=false reportedVisible=false
          mAppStopped=true
          numInterestingWindows=1 numDrawnWindows=1 inPendingTransaction=false allDrawn=true (animator=true)
          startingData=null removed=false firstWindowDrawn=true mIsExiting=false


    DimLayerController
      Task=1208
        dimLayer=shared animator=null continueDimming=false
        mDimSurface=Surface(name=DimLayerController/Stack=0) mLayer=21034 mAlpha=0.0
        mLastBounds=[-180-320][9001600] mBounds=[-180-320][9001600]
        Last animation:  mDuration=200 mStartTime=1757226 curTime=1917554
         mStartAlpha=0.6 mTargetAlpha=0.0
      Task=1210
        dimLayer=shared animator=null continueDimming=false
        mDimSurface=Surface(name=DimLayerController/Stack=0) mLayer=21034 mAlpha=0.0
        mLastBounds=[-180-320][9001600] mBounds=[-180-320][9001600]
        Last animation:  mDuration=200 mStartTime=1757226 curTime=1917554
         mStartAlpha=0.6 mTargetAlpha=0.0
      Task=1206
        dimLayer=shared animator=null continueDimming=false
        mDimSurface=Surface(name=DimLayerController/Stack=0) mLayer=21034 mAlpha=0.0
        mLastBounds=[-180-320][9001600] mBounds=[-180-320][9001600]
        Last animation:  mDuration=200 mStartTime=1757226 curTime=1917554
         mStartAlpha=0.6 mTargetAlpha=0.0
      Task=1209
        dimLayer=shared animator=null continueDimming=false
        mDimSurface=Surface(name=DimLayerController/Stack=0) mLayer=21034 mAlpha=0.0
        mLastBounds=[-180-320][9001600] mBounds=[-180-320][9001600]
        Last animation:  mDuration=200 mStartTime=1757226 curTime=1917554
         mStartAlpha=0.6 mTargetAlpha=0.0
      Stack=0
        dimLayer=shared animator=null continueDimming=false
        mDimSurface=Surface(name=DimLayerController/Stack=0) mLayer=21034 mAlpha=0.0
        mLastBounds=[-180-320][9001600] mBounds=[-180-320][9001600]
        Last animation:  mDuration=200 mStartTime=1757226 curTime=1917554
         mStartAlpha=0.6 mTargetAlpha=0.0
      Stack=1
        dimLayer=shared animator=null continueDimming=false
        mDimSurface=Surface(name=DimLayerController/Stack=0) mLayer=21034 mAlpha=0.0
        mLastBounds=[-180-320][9001600] mBounds=[-180-320][9001600]
        Last animation:  mDuration=200 mStartTime=1757226 curTime=1917554
         mStartAlpha=0.6 mTargetAlpha=0.0

    DockedStackDividerController
      mLastVisibility=false
      mMinimizedDock=false
      mAdjustedForIme=false

1557715252525

打印简单方式: adb shell wm size

AndydeMacBook-Pro:~ andy$ adb shell wm size
Physical size: 720x1280

执行结果: 

1557715365614

发表评论

0 个回复