Kevik Kevik - 1 year ago 172
Android Question

How to get height and width of navigation bar programmatically

the black navigation bar on the bottom of the screen is not easily removable in Android, It has been part of Android since 3.0 as a replacement for hardware buttons.

it is shown here in the pic.

how can I get the size of the width and height of this UI element in pixels? There has to be some code for this. Any ideas?

System Bar

Answer Source

Try below code:

Resources resources = context.getResources();
int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
if (resourceId > 0) {
    return resources.getDimensionPixelSize(resourceId);
return 0;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download