PDA

View Full Version : Stop Orientation Change



gary7au
28 Jan 2011, 7:28 PM
I would like to stop orientation change for my landing page.

I have tried 'layoutOnOrientationChange: false' which did not work. Any ideas?

LandingPage = Ext.extend(Ext.Panel, {
border: false,
fullscreen: true,
cls: 'landingPage',
layoutOnOrientationChange: false,
.
.
.
.

jmoraltu
25 Mar 2011, 4:26 AM
Has any one figured it out?
I have try



monitorOrientation:false,
layoutOnOrientationChange: false

And its not working

mikih
30 Jun 2011, 5:47 AM
same for me here.... can't get rid of the orientation change!! Guys what is so special about this?? Does anyone have a hack to prevent the event from firing...


Thanks

Flo

eyepoker
1 Jul 2011, 6:16 PM
same here....

steve1964
2 Jul 2011, 7:59 AM
Hi, in short in a webapp you cant. You can stop orientation change both on iOS and Android by using Phonegap.

eyepoker
2 Jul 2011, 3:28 PM
Thats what i was figuring.... if you can point at the file to edit that would be cool. Else, i'll be taking a look tomorrow, if i find it i'll post up.

steve1964
2 Jul 2011, 3:40 PM
It's not a file, Phonegap is a tool that allow you to create app starting from your Sencha Touch WebApp;
http://www.phonegap.com/

eyepoker
2 Jul 2011, 4:20 PM
I realize that... we either have to call a phonegap function or mess with one of phone gap's xml files, that was my take-away from your post. If however i'm on the wrong track then please let me know.

steve1964
3 Jul 2011, 7:36 AM
On Androd you set the allowed orientation in the AndroidManifest.xml, on iOS, if your using the latest xCode, you set it via xCode directly or modififying the yourProject.plist file. You have not to call any function in Phonegap, just modify the 2 files.

eyepoker
3 Jul 2011, 11:14 AM
thanks steve... that led me to the following line:

<activity android:name="MainActivity" android:configChanges="keyboardHidden|orientation">

Some quick background for those reading, the above tells android not to auto-rotate because rotation is being handled by the app (from: http://stackoverflow.com/questions/1512045/how-to-disable-orientation-change-in-android ). Since I'm not handling rotation at all then rotation isn't supposed to happen.

Unfortunately the app thats generated doesn't run on my device. It will "install"... but upon installation it won't launch and it doesn't appear within the list of installed apps.

The relevant portion of my AndroidManifest.xml looks like this (with the original code commented out):




<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">

<activity android:name="MainActivity" android:configChanges="keyboardHidden|orientation" />

<!--activity android:name=".DefaultActivity" android:label="@string/app_name" android:configChanges="orientation|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-->

</application>

eyepoker
3 Jul 2011, 11:57 AM
I believe I've come across the proper settings for an app (not web app):


<activity android:name=".DefaultActivity" android:label="@string/app_name" android:screenOrientation="portrait">

The above sets me up for portrait. If you want landscape then replace "portrait" with "landscape"

manifest docs: http://developer.android.com/guide/topics/manifest/manifest-intro.html

tested on an EVO4G, android 2.1