android-获取屏幕分辨率 - 随心

Display display = getWindowManager().getDefaultDisplay();
Log.i("view", "height:"+display.getHeight());
Log.i("view","width:"+display.getWidth());


DisplayMetrics dm=new DisplayMetrics();  

getWindowManager().getDefaultDisplay().getMetrics(dm);  

Log.i("view", "height:"+dm.widthPixels);
Log.i("view","width:"+dm.heightPixels);

你可能感兴趣的:(android-获取屏幕分辨率 - 随心)