Android 获取屏幕分辨率和真实可以用分辨率

屏幕分辨率

        Resources resources = this.getResources();
        DisplayMetrics dm = resources.getDisplayMetrics();
        width= dm.widthPixels;
        height = dm.heightPixels;

        Logger.d("width="+width);
        Logger.d("height="+height);

可用真实分辨率

         WindowManager windowManager = getWindow().getWindowManager();
        Point point = new Point();
        windowManager.getDefaultDisplay().getRealSize(point);
        width = point.x;
        height = point.y;

你可能感兴趣的:(android,java,开发语言)