android 获得屏幕宽和高

DisplayMetricsdisplayMetrics=newDisplayMetrics();

this.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);

intheight=displayMetrics.heightPixels;

intwidth=displayMetrics.widthPixels;

Log.i("屏幕宽度:",String.valueOf(width));

Log.i("屏幕高度:",String.valueOf(height));

你可能感兴趣的:(android)