I want to know what is the size of the navigation bar in pixel using ADB.

Using adb shell wm size gives the complete screen size instead of only the navigation bar.

Is there any way to get it?


2 Answers 2


Enter this one-liner:

adb shell dumpsys window windows| sed -n '/Window .*NavigationBar.*:/,/Window .*:/p'| grep 'Requested'

Alternatively, if you don't have Linux/Mac, try this:

adb shell
dumpsys window windows | toybox sed -n '/Window .*NavigationBar.*:/,/Window .*:/p'| grep 'Requested'

What's happening in that one liner is this:

  1. we use dumpsys to output all the details of all the windows displayed on the screen (irrespective of the screen on or off)

  2. we filter the content using sed to show only those lines which have information about Navigation Bar

  3. we grep the information we need.

    You can alternatively try grepping for grep mSystemDecorRect. I don't know which one is more reliable in all circumstances.

Expected output example:

Requested w=1080 h=126 mLayoutSeq=10835

# if 'mSystemDecorRect' was grepped, then:

mSystemDecorRect=[0,0][1080,126] mLastClipRect=[0,0][1080,126]

w: width, h: height, of your navigation bar respectively.

Note: for some reason if the one-liner fails to work or gives unexpected output, filter it like this. Get the dump using that first dumpsys command, then find the entry for your NavigationBar, and within that, look for the size.

Tested on OnePlus 6 running Android 10.

Credits: Fiximan of Unix & Linux for sed command.

  • 1
    Thanks. Also possible to get using: adb shell dumpsys SurfaceFlinger | grep -i “Navigation”
    – Spyder
    Jul 20, 2020 at 16:32

On OnePlus 3 running Android 9, replace NavigationBar with StatusBar instead.

adb shell dumpsys window windows| sed -n '/Window .*StatusBar.*:/,/Window .*:/p'| grep 'Requested'

It will return this

Requested w=1080 h=63 mLayoutSeq=3640
  • This will return the size of the status/notification bar at the top instead, not the navigation bar at the bottom.
    – Andrew T.
    Jan 4, 2022 at 7:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .