public static int getDisplayMetrics(Context context){
DisplayMetrics metrics=new DisplayMetrics();
((Activity)context).getWindowManager().getDefaultDisplay().getMetrics(metrics);
return metrics.heightPixels;
}
DisplayMetrics metrics=new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int heightPixels = metrics.heightPixels;
int widthPixels = metrics.widthPixels;
时间: 2024-10-11 03:50:39