public static void intScreen(Activity mLauncher){
//1
DisplayMetrics displayMetrics = mLauncher.getResources().getDisplayMetrics();
width = displayMetrics.widthPixels;
height = displayMetrics.heightPixels;
midXOfScreen = width / 2.0f;
midYOfScreen = height / 2.0f;
/*//2
DisplayMetrics dm = new DisplayMetrics();
mLauncher.getWindowManager().getDefaultDisplay().getMetrics(dm);
width = dm.widthPixels;
height = dm.heightPixels;
//3
Display display = mLauncher.getWindowManager().getDefaultDisplay();
width = display.getWidth();
height = display.getHeight();*/
}
Display_获取屏幕宽高
最新推荐文章于 2022-11-17 17:46:21 发布