获取状态栏高度

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

获取actionBar的高宽度

有一个属性:

android:layout_width="?attr/actionBarSize"
android:layout_height="?attr/actionBarSize"

获取屏幕高度,宽度

DisplayMetrics dm = new DisplayMetrics();  
  
this.getWindowManager().getDefaultDisplay().getMetrics(dm);//this指当前activity  
  
screenWidth =dm.widthPixels;  
  
screenHeight =dm.heightPixels;

 

相关文章:

  • 2021-06-18
  • 2021-05-29
  • 2022-12-23
  • 2022-12-23
  • 2021-07-01
  • 2022-12-23
  • 2021-08-06
  • 2022-12-23
猜你喜欢
  • 2021-11-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-02
相关资源
相似解决方案