List of utility methods to do StatusBar Size Get
int | getStatusBarHeight(Activity activity) get Status Bar Height Rect rect = new Rect(); Window win = activity.getWindow(); win.getDecorView().getWindowVisibleDisplayFrame(rect); return rect.top; |
int | getStatusBarHeight(Activity activity) get Status Bar Height try { Class<?> clazz = Class.forName("com.android.internal.R$dimen"); Object object = clazz.newInstance(); Field field = clazz.getField("status_bar_height"); int dpHeight = Integer.parseInt(field.get(object).toString()); return activity.getResources().getDimensionPixelSize(dpHeight); } catch (Exception e1) { e1.printStackTrace(); ... |
int | getStatusBarHeight(Context context) get Status Bar Height int result = 0; int resourceId = context.getResources().getIdentifier( "status_bar_height", "dimen", "android"); if (resourceId > 0) { result = context.getResources().getDimensionPixelSize( resourceId); return result; ... |
int | getStatusbarHeight(Activity activity) get Statusbar Height int statusbarHeight; try { Rect frame = new Rect(); activity.getWindow().getDecorView() .getWindowVisibleDisplayFrame(frame); statusbarHeight = frame.top; } catch (Exception e) { statusbarHeight = getDensityDimen(activity, ... |