获取android手机屏幕的大小,由于android sdk类库的强大,两行代码就可以搞定。

Android下获取手机屏幕大小

代码如下

private void getScreenPix() { DisplayMetrics dm=new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); String tmp="当前手机分辨率为:"+Integer.toString( dm.widthPixels)+":"+Integer.toString(dm.heightPixels); tv_screen_pix.setText(tmp); }

相关文章:

  • 2022-01-11
  • 2022-12-23
  • 2021-08-17
  • 2022-12-23
  • 2021-08-15
  • 2021-07-10
  • 2021-06-11
  • 2021-12-29
猜你喜欢
  • 2021-05-23
  • 2021-11-17
  • 2021-11-17
  • 2021-11-17
  • 2021-06-24
  • 2021-11-17
相关资源
相似解决方案