@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); int orientation = getResources().getConfiguration().orientation; if (orientation == Configuration.ORIENTATION_LANDSCAPE) {// 横屏 } else if (orientation == Configuration.ORIENTATION_PORTRAIT) {// 竖屏 } }