CodenameLambda1
CodenameLambda1

Reputation: 1299

Screen orientation forced to portrait, but still, the activities will rotate to landscape when tilted!! How to force portrait mode?

I've searched stackoverflow for this and didn't get any solution to what I am looking for.

In my manifest file I am writing the following line for each activity

android:screenOrientation="portrait" android:configChanges="orientation|keyboardHidden"

But still, all the activities rotate to landscape on tilting the phone.

How can I solve this issue ?

"Once upon a time I was a confident developer in C/C++,iOS,Java,Javascript,C# but thank you android! now I can't even look eye to eye in mirror!"

Upvotes: 0

Views: 1405

Answers (1)

Hariharan
Hariharan

Reputation: 24853

May be this will help

In your manifest file after your main activity write below line

 android:screenOrientation="portrait"

Or in your coding after setContentView() add this line..

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

Upvotes: 3

Related Questions