private void setFullScreen() { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); webUINavigationBar.setVisibility(View.GONE); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); } private void quitFullScreen() { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); webUINavigationBar.setVisibility(View.VISIBLE); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); } 在清单文件里 <activity android:name=".你要横竖屏切换的activity" android:configChanges="screenSize|keyboardHidden|orientation" android:screenOrientation="portrait" android:windowSoftInputMode="adjustResize|stateHidden" />