Android any orientation XML layout

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?


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.

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

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

Need Your Help

MDAC OLEDB Command Prompt 32-Bit Problem

c# .net oledb 32bit-64bit mdac

A couple years ago I wrote a C#.NET program that used Microsoft ACE and JET OLEDB to convert Excel spreadsheets to CSV files. Recently we upgraded to a Windows Server 2008 x64 server. Since JET was

How do I handle multiple apps running on a single server?

node.js chef

I am new to Chef. I just finished creating a cookbook that deploys a node.js app, configures Nginx, and then starts the app as 1 or more workers that are "load balanced" by Nginx. It works great. I...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.