尝试以纵向/横向/反向旋转应用程序 肖像/逆向风景。它的旋转应用只有三种模式但是 无法以反向纵向旋转应用程序。
我的代码:
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (isRecording == false) {
Log.v("new orientation", "yes");
if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
wholeView.setOrientation(1);
}
else if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
wholeView.setOrientation(0);
}else if (newConfig.orientation == Configuration.ORIENTATION_UNDEFINED) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
wholeView.setOrientation(0);
}else if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT)
{
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
wholeView.setOrientation(LinearLayout.VERTICAL);
}