Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Why is not working screenOrientation ?

I set screenOrientation to be portrait and it doesn't workin. It still can go landscape.

<?xml version="1.0" encoding="utf-8"?> <manifest package="com.example.space.story" xmlns:android="http://schemas.android.com/apk/res/android">

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".StoryActivity"
              android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>

            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
</application>

</manifest>

2 Answers

Nope, this not work to ! :(

Hi,

Did you put:

android:screenOrientation="portrait"

(change "portrait" to "landscape" if you want it in landscape mode)in the "application" section of the "AndroidManifest.xml" file?

Hope this helps