activity:

   DisplayMetrics dm = new DisplayMetrics();
   this.getWindowManager().getDefaultDisplay().getMetrics(dm);

   sW = dm.widthPixels;
   sH = dm.heightPixels;

service:

   DisplayMetrics dm = new DisplayMetrics();
   dm = getResources().getDisplayMetrics();
   int screenWidth = dm.widthPixels;
   int screenHeight = dm.heightPixels;

相关文章:

  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-17
  • 2021-08-17
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
相关资源
相似解决方案