Android StatusBar Size Get getStatusBarHeight(Activity activity)

Here you can find the source of getStatusBarHeight(Activity activity)

Description

get Status Bar Height

Declaration

public static int getStatusBarHeight(Activity activity) 

Method Source Code

//package com.java2s;
import android.app.Activity;

import android.graphics.Rect;

import android.view.Window;

public class Main {
    public static int getStatusBarHeight(Activity activity) {
        Rect rect = new Rect();
        Window win = activity.getWindow();
        win.getDecorView().getWindowVisibleDisplayFrame(rect);
        return rect.top;
    }//from w  w w  . j  a  v a  2  s  . c o  m
}

Related

  1. getStatusBarHeight(Activity activity)
  2. getStatusBarHeight(Context context)
  3. getStatusbarHeight(Activity activity)