displaymetrics Introduction:Android can be set to scale as the window resizes, but even so, the phone program designer must know the boundaries of the phone screen to avoid the layout distortion caused by scaling. Android provides DISPLAYMETIRCS class for easy access to resolution. The Displaymetrics class under the Andorid.util package provides a general information about the display, such as display size, resolution, and font. To get the Displaymetrics member, first initialize an object as follows:
DisplayMetrics metrics =newDisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics;
Note: The constructor displaymetrics does not need to pass any arguments; after calling Getwindowmanager (), the handle of the existing activity is obtained, at which point the Getdefaultdisplay () The Displaymetrics method stores the resulting width and height dimensions in the object, and the resulting width and height dimensions are in pixels (Pixel).
Reference: http://blog.csdn.net/zhangqijie001/article/details/5894872
Android gets screen resolution and Displaymetrics