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

  Rect frame = new Rect();
  getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
  int statusBarHeight = frame.top;

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-13
  • 2021-11-18
  • 2021-08-06
猜你喜欢
  • 2021-08-30
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
  • 2021-06-25
  • 2021-10-24
  • 2021-09-06
相关资源
相似解决方案