get Navigation Bar Height - Android User Interface

Android examples for User Interface:NavigationBar

Description

get Navigation Bar Height

Demo Code


//package com.java2s;

import android.content.Context;
import android.content.res.Resources;

public class Main {
    public static int getNavBarHeight(Context context) {
        Resources resources = context.getResources();

        int resourceId = resources.getIdentifier("navigation_bar_height",
                "dimen", "android");
        if (resourceId > 0) {
            return resources.getDimensionPixelSize(resourceId);
        }//from  w w  w.j  av a  2 s.  co  m
        return 0;
    }
}

Related Tutorials