1. 程式人生 > >Android:如何獲取屏幕的寬高

Android:如何獲取屏幕的寬高

thp metrics eight bsp new service ont pixel pre

WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
        DisplayMetrics dm = new DisplayMetrics();
        wm.getDefaultDisplay().getMetrics(dm);
        pm_width = dm.widthPixels;
        pm_height = dm.heightPixels;

Android:如何獲取屏幕的寬高