Я хочу, чтобы мое приложение работало только в альбомной ориентации в Android

Я хочу, чтобы мое приложение работало только в альбомном режиме, но не могу заставить его работать. Я указал screenOrientation = "landscape" , даже если первая страница будет в альбомной ориентации, а остальные действия будут в портретной.

XML-ФАЙЛ

<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".Main"
              android:label="@string/app_name"
              android:screenOrientation="landscape" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>     

    </activity>

    <activity android:name=".IntroHome"
              android:label="@string/app_name"
              android:screenOrientation="landscape">
    </activity>

    <activity android:name=".ObjectivesPage"
              android:label="@string/app_name"
              android:screenOrientation="landscape" >
    </activity>

    <activity android:name=".MenuPage"
              android:label="@string/app_name"
              android:screenOrientation="landscape" >
    </activity>
</application>

КЛАСС JAVA

public class ObjectivesPage extends Activity{

    ImageButton  imgButton;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.objectivespage);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

        imgButton = (ImageButton)findViewById(R.id.buttonCloseNGo);
        imgButton.setOnClickListener(onClickCloseNGo);
    }

    private OnClickListener onClickCloseNGo = new OnClickListener(){

        public void onClick(View v) {
            Intent intent = new Intent(ObjectivesPage.this,MenuPage.class);
            startActivity(intent);
        }
    };
}
49
задан Sami Kuhmonen 4 June 2015 в 20:43
поделиться