1.方法一

Display display = getWindowManager().getDefaultDisplay();
 Config.screenWidth = display.getWidth();
 Config.screenHeight = display.getHeight();

 

2. 方法二:

 DisplayMetrics metrics = new DisplayMetrics();
 getWindowManager().getDefaultDisplay().getMetrics(metrics);
 int screenWidth = metrics.widthPixels;
 int screenHeight = metrics.heightPixels;  

 

相关文章:

  • 2022-12-23
  • 2021-10-08
  • 2021-10-21
  • 2022-12-23
  • 2022-02-08
  • 2021-11-15
  • 2021-12-14
猜你喜欢
  • 2022-01-17
  • 2022-12-23
  • 2022-02-11
  • 2021-12-20
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案