Android examples for User Interface:StatusBar
get System Bar Height In Dp
//package com.java2s; import android.content.Context; import android.util.TypedValue; public class Main { private static TypedValue mTmpValue = new TypedValue(); public static int getSystemBarHeightInDp(Context context) { int result = 0; int resourceId = context.getResources().getIdentifier( "system_bar_height", "dimen", "android"); if (resourceId > 0) { result = getResourceValue(context, resourceId); }// w w w. j a v a 2s.c o m return result; } public static int getResourceValue(Context context, int resId) { TypedValue value = mTmpValue; context.getResources().getValue(resId, value, true); return (int) TypedValue.complexToFloat(value.data); } }