[英]air android app always launches in portrait mode irrespective of the way the android device is held ( landscape/portrait)
我有一個在Android設備(三星TAB)上運行的AIR android應用程序。 我希望當用戶啟動將設備橫向握住的應用程序時,以橫向模式布局應用程序(縱向也是如此)。
但是AIR應用程序始終以縱向模式啟動,而不管設備的握持方式如何。
我嘗試了以下方法-
使用stage.deviceorientation(但是當應用啟動時(在applicationComplete通知之后),該值為UNKNOWN)
使用階段調整大小事件。 (這會在啟動時自動觸發,不需要手動調整大小-盡管這些值基於縱向模式-寬度為600高度為1024(否則應該是))
當我嘗試更改設備的方向時,只有在啟動時,我才能獲得正確的值,但我看到所需值的問題。
您能對此問題提出建議嗎?
謝謝
即使我沒有答案...我也想指出... Nguyen的回復完全不相關...這個問題是關於AIR的,而不是關於本機Android開發的
雖然...您可能想研究stage.orientation而不是stage.deviceOrientation
在應用程序激活處理程序中嘗試以下操作:
NativeApplication.nativeApplication.addEventListener(flash.events.Event.ACTIVATE, function (e:*):void{
if(stage.orientation == StageOrientation.UNKNOWN){
stage.setOrientation(StageOrientation.ROTATED_LEFT);
}
});
使用getResources().getConfiguration().orientation
。
if(myCurrentActivity.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)
{
// code to do for Portrait Mode
} else {
// code to do for Landscape Mode
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.