DisplayMetrics dm = new DisplayMetrics();getWindowManager().getDefaultDisplay().getMetrics(dm);width = dm.widthPixels;//宽度height = dm.heightPixels ;//高度
若没有activity,则使用
WindowManager winManager=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
setTitle(winManager.getDefaultDisplay().getWidth()+"*"+winManager.getDefaultDisplay().getHeight());
- WindowManager winManage = getWindowManager() ;
- Display winDisplay = winManage.getDefaultDisplay() ;
- int winHeight = winDisplay.getHeight() ;
- int winWeight = winDisplay.getWidth() ;
获取