Android navigation bar size in xml

fragon picture fragon · Sep 1, 2014 · Viewed 27.9k times · Source

Is there any way to get the size of navigation bar in android in xml file similar to this?

 android:paddingTop="?android:attr/actionBarSize"

where actionBarSize is navigation bar size?

Answer

Gaëtan Maisse picture Gaëtan Maisse · Nov 5, 2014

After looking in android source it looks like there is dimens for navigation bar height :

@android:dimen/navigation_bar_height

There are other dimens linked to nav bar, examples from android values/dimens.xml :

<!-- Height of the bottom navigation / system bar. -->
<dimen name="navigation_bar_height">48dp</dimen>
<!-- Height of the bottom navigation bar in portrait; often the same as @dimen/navigation_bar_height -->
<dimen name="navigation_bar_height_landscape">48dp</dimen>
<!-- Width of the navigation bar when it is placed vertically on the screen -->
<dimen name="navigation_bar_width">42dp</dimen>