Android获取屏幕尺寸宽高的point方式

可以用point的方式去获取

 WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        Display display = manager.getDefaultDisplay();
        Point size = new Point();
        display.getSize(size);
        float weight = (float) size.x;
        float height = (float) size.y;
        weightPhone = DensityUtil.px2dip(context, weight);
        heightPhone = DensityUtil.px2dip(context, height);
        HLog.e("GridSquareViewAdapter--weightPhone---", "" + weightPhone);
        HLog.e("GridSquareViewAdapter--heightPhone---", "" + heightPhone);

你可能感兴趣的:(Android获取屏幕尺寸宽高的point方式)