[Android Tips] 1. Getting StatusBar Height

public int getStatusBarHeight() {
  int result = 0;
  int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
  if (resourceId > 0) {
      result = getResources().getDimensionPixelSize(resourceId);
  }
  return result;
}
原文地址:https://www.cnblogs.com/shaobin0604/p/3613469.html