andorid orientation setting

Related API:

      ActivityInfo.java

      Activity.java     

 

 

       // switch the screen orientation together

       // portrait: 竖向, default orientation in manifest.xml; landscape: 横向

        if (getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {

            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

        }

        else if (getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {

            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

        }

 

       manifest.xml:

 

       <activity

            android:name=".activity.ConfigActivity"

            android:screenOrientation="portrait" >

        </activity>

你可能感兴趣的:(andorid orientation setting)