Display display =context.getWindowManager().getDefaultDisplay();
screenHeight = display.getHeight();
screenWidth = display.getWidth();
在AndroidManifest.xml进行配置
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true"/> <uses-sdk android:minSdkVersion="7" android:maxSdkVersion="8" />