试图以反向纵向旋转应用程序,但它无法正常工作

时间:2013-03-28 12:45:03

标签: android android-layout android-orientation

  

尝试以纵向/横向/反向旋转应用程序   肖像/逆向风景。它的旋转应用只有三种模式但是   无法以反向纵向旋转应用程序。

     

我的代码:

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);
            }

0 个答案:

没有答案