android getDecorView()的作用

decorView是window中的最顶层view,可以从window中通过getDecorView获取到decorView。
通过decorView获取到程序显示的区域,包括标题栏,但不包括状态栏。间接可以计算状态栏高度。
比如计算状态栏的高度:

  Rect frame = new Rect();
  getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
  int statusBarHeight = frame.top;
原文地址:https://www.cnblogs.com/zhujiabin/p/5166056.html