Question

Hello I am trying to make my layout compatible with all orientation screen types (landscape/portrait). For that I am using layout-land and layout-port.

This works for devices that have only 2 orientation positions (landscape and portrait) but is not working if I rotate a device that supports 4 orientation positions (land left/right, port upside down/upside). Is working only on default land position but if I rotate the device on the other landscape position, android choose the layout-port layouts instead of layout-land.

How can I solve this problem in XML? Or the only solution is to manage myself the orientation changes?

Was it helpful?

Solution 4

It seems that the layout-land works.. the problem was that I managed the orientation change by myself and took only 2 types of orientation..

(I manage the orientation just to get down the app title and make it full screen in landscape..)

Thank you for your answers though

OTHER TIPS

Here you will notice that I just listen to the stage for the StageOrientationEvent.ORIENTATION_CHANGE event. When the event fires there are five possible orientations that the stage can be in: default, rotated left, rotated right, upside down, and unknown.

http://www.unitedmindset.com/jonbcampos/2010/09/27/air-for-android-screen-orientation/

You can't do this using XML. You have to do programmatic. To detect orientation change you can use OrientationEventListener

Your targetSDK has to be 2.2 (when the reverseLandscape and reversePortrait orientations were introduced... pretty sure it was in 2.2) and your device has to support these orientations. For example a Sony Tablet S won't go into reverseLandscape but will do reversePortrait

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top