Android orientation problem

I have an application that works only in landscape orientation. I installed this in the xml layout. When I run the application, it works fine. But when the application starts, and then, if I lock the phone and then unlock, the application is in portrait mode for the first 1-2 seconds, and then in the landscape. Can I skip these 2 seconds?

+4
source share
5 answers

Try defining it explicitly in your manifest. Add android:screenorientation="portrait" to each <activity> element.

+2
source

In order not to be poor, I really hope that you will allow this. I just wanted to throw it away that I noticed this behavior (usually for me applications should remain in the portrait, but they show the landscape for about 2 seconds) in several applications on my Sprint HTC Hero, including the standard home application and many of the standard ones included applications (contacts etc.). I'm starting to suspect that this is an android problem. Again, feel free to disagree with me, but I just wanted to say that I noticed this in many applications, and you are not alone here: / However, there are some applications on which I did not notice them, so a) I was just lucky or b) there is a right decision

+1
source

Run this in your onCreate (), before setcontentview :

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

I use this method in my applications, and I never notice a change in orientation. It is locked in the required orientation.

+1
source

I hope this help; put them on every activity item in your manifest Android file.

 android:configChanges="orientation" android:screenOrientation="landscape" 

Of course, this is a landscape; this time my brain was not the fastest.

0
source

To be provocative, in fact, what he needs to put in every activity element in his manifest is:

android:screenOrientation="landscape"

not a "portrait": P

0
source

All Articles