Android获取屏幕高度宽度的方法

WindowManager wm = (WindowManager) this 
.getSystemService(Context.WINDOW_SERVICE); 
int width = wm.getDefaultDisplay().getWidth(); 
int height = wm.getDefaultDisplay().getHeight(); 

获取到的单位是像素 px
 

猜你喜欢

转载自blog.csdn.net/taoerchun/article/details/92602821