获取手机屏幕长宽
DisplayMetrics mDisplayMetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(mDisplayMetrics); int W = mDisplayMetrics.widthPixels; int H = mDisplayMetrics.heightPixels; Log.i("Main", "Width = " + W); Log.i("Main", "Height = " + H);