/**
* 获得手机屏幕宽高
*
* @return
*/
public int getHeight(Context context){
DisplayMetrics dm = new DisplayMetrics();
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
//获取屏幕信息
manager.getDefaultDisplay().getMetrics(dm);
return dm.heightPixels;
}
public int getWidth(Context context){
DisplayMetrics dm = new DisplayMetrics();
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
//获取屏幕信息
manager.getDefaultDisplay().getMetrics(dm);
return dm.widthPixels;
}
* 获得手机屏幕宽高
*
* @return
*/
public int getHeight(Context context){
DisplayMetrics dm = new DisplayMetrics();
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
//获取屏幕信息
manager.getDefaultDisplay().getMetrics(dm);
return dm.heightPixels;
}
public int getWidth(Context context){
DisplayMetrics dm = new DisplayMetrics();
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
//获取屏幕信息
manager.getDefaultDisplay().getMetrics(dm);
return dm.widthPixels;
}