1. 此法適用於API Level 17 以上
DisplayManager mDm = (DisplayManager)getSystemService(Context.DISPLAY_SERVICE);
Display dp = mDm.getDisplay(Display.DEFAULT_DISPLAY);
//current screen orientation
int rotation = dp.getRotation();
//current real screen size
Point pt = new Point();
dp.getRealSize(pt);