Android:如何获取屏幕的宽高

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

 

posted on 2018-12-08 10:48  迷途行者  阅读(321)  评论(0编辑  收藏  举报

导航