Questions tagged [orientation]

Orientation is the way up, down, left or right something is facing or being held in. Typically, you distinguish between Portrait (or Vertical) and Landscape (or Horizontal) orientations.

Orientation is the way up, down, left or right something is facing or being held in.
With the advent of new sophisticated smart phones and devices this tag details questions about bugs and features people may have relating to the orientation of a device.

Portrait orientation is that one where the width is smaller than the height.
Landscape orientation is that one where the width is bigger than the height.

4159 questions
470
votes
24 answers

Check orientation on Android phone

How can I check if the Android phone is in Landscape or Portrait?
Mohit Deshpande
  • 53,877
  • 76
  • 193
  • 251
331
votes
24 answers

Flutter: how to prevent device orientation changes and force portrait?

I would like to prevent my application from changing its orientation and force the layout to stick to "portrait". In the main.dart, I put: void main(){ SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, …
boeledi
  • 6,837
  • 10
  • 32
  • 42
324
votes
12 answers

Force "portrait" orientation mode

I'm trying to force the "portrait" mode for my application because my application is absolutely not designed for the "landscape" mode. After reading some forums, I added these lines in my manifest file:
thomaus
  • 6,170
  • 8
  • 45
  • 63
237
votes
9 answers

How can I get the current screen orientation?

I just want to set some flags when my orientation is in landscape so that when the activity is recreated in onCreate() i can toggle between what to load in portrait vs. landscape. I already have a layout-land xml that is handling my layout. public…
Sheehan Alam
  • 60,111
  • 124
  • 355
  • 556
236
votes
8 answers

Background task, progress dialog, orientation change - is there any 100% working solution?

I download some data from internet in background thread (I use AsyncTask) and display a progress dialog while downloading. Orientation changes, Activity is restarted and then my AsyncTask is completed - I want to dismiss the progess dialog and start…
fhucho
  • 34,062
  • 40
  • 136
  • 186
186
votes
18 answers

Is [UIScreen mainScreen].bounds.size becoming orientation-dependent in iOS8?

I ran the following code in both iOS 7 and iOS 8: UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; BOOL landscape = (orientation == UIInterfaceOrientationLandscapeLeft || orientation ==…
lwxted
  • 2,419
  • 2
  • 16
  • 22
163
votes
13 answers

How do I lock the orientation to portrait mode in a iPhone Web Application?

I'm building a iPhone Web Application and want to lock the orientation to portrait mode. is this possible? Are there any web-kit extensions to do this? Please note this is an application written in HTML and JavaScript for Mobile Safari, it is NOT…
Kevin
  • 9,309
  • 12
  • 44
  • 51
161
votes
3 answers

Lock screen orientation (Android)

I'm writing an android application that uses tabs with different contents (activities). In one of these activities, I would like to lock the screen orientation to "Landscape"-mode, but in the other activities, I want the normal orientation…
user573536
  • 2,335
  • 3
  • 17
  • 8
159
votes
11 answers

How do I specify different layouts for portrait and landscape orientations?

I've seen references to being able to specify two separate layout xml files for an activity, one for Portrait and one for Landscape. I've not been to find any information on how to do that though. How do I specify for each activity which xml file…
Jay Askren
  • 10,282
  • 14
  • 53
  • 75
152
votes
20 answers

Android WebView: handling orientation changes

The issue is the performance following rotation. The WebView has to reload the page, which can be a bit tedious. What's the best way of handling an orientation change without reloading the page from source each time?
glennanthonyb
  • 1,855
  • 2
  • 14
  • 10
132
votes
6 answers

Android: alternate layout xml for landscape mode

How can I have one layout for landscape and one for portrait? I want to assume extra width and conserve vertical space when the user rotates the phone over sideways.
700 Software
  • 85,281
  • 83
  • 234
  • 341
126
votes
7 answers

Android Fragment lifecycle over orientation changes

Using the compatibility package to target 2.2 using Fragments. After recoding an activity to use fragments in an app I could not get the orientation changes/state management working so I've created a small test app with a single FragmentActivity and…
MartinS
  • 6,134
  • 10
  • 34
  • 40
126
votes
8 answers

Android - Camera preview is sideways

I am using a Preview to display what the camera see's on the screen. I can get everything working fine, surface created, surface set and the surface is displayed. However it always displays the picture at an incorrect 90 degree angle in portrait…
Donal Rafferty
  • 19,707
  • 39
  • 114
  • 191
109
votes
4 answers

Android phone orientation overview including compass

I've been trying to get my head around the Android orientation sensors for a while. I thought I understood it. Then I realised I didn't. Now I think (hope) I have a better feeling for it again but I am still not 100%. I will try and explain my…
Tim
  • 5,767
  • 9
  • 45
  • 60
109
votes
7 answers

How to lock orientation during runtime

Is there a way to lock orientation during runtime? For example I'd like to allow the user to lock the screen to landscape if the user currently in landscape and toggle the menu option.
Jared
  • 1,269
  • 2
  • 10
  • 14
1
2 3
99 100