PHP
·
发表于 5年以前
·
阅读量:8410
@SuppressWarnings ( "deprecation" )
public static int getDeviceWidth(Context context) {
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
return manager.getDefaultDisplay().getWidth();
}
@SuppressWarnings ( "deprecation" )
public static int getDeviceHeight(Context context) {
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
return manager.getDefaultDisplay().getHeight();
}