第一种:
public point getdisplaymetrics() { displaymetrics dm = new displaymetrics(); dm = getapplicationcontext().getresources().getdisplaymetrics(); int screenwidth = dm.widthpixels; int screenheight = dm.heightpixels; return new point(screenwidth ,screenheight ); }
第二种:
public point getdisplayscreen() { windowmanager windowmanager = getwindowmanager(); display display = windowmanager.getdefaultdisplay(); screenwidth = display.getwidth(); screenheight = display.getheight(); return new point(screenwidth ,screenheight ); }