Domanda

Ciao io sto cercando di fare il mio layout compatibile con tutti i tipi di schermo orientamento (orizzontale / verticale). Per questo sto usando layout-land e layout-port.

Questo funziona per i dispositivi che hanno solo 2 posizioni di orientamento (orizzontale e verticale), ma non funziona se ruoto un dispositivo che supporta 4 posizioni di orientamento (terra sinistra / destra, porta a testa in giù / a testa). Sta lavorando solo sulla posizione di terra di default ma se ruotare il dispositivo d'altra posizione orizzontale, Android scelgo i layout layout-port invece di layout-land.

Come posso risolvere questo problema in XML? O l'unica soluzione è quella di gestire me stesso i cambiamenti di orientamento?

È stato utile?

Soluzione 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

Altri suggerimenti

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top