Android 方向星系标签空中椋鸟

Android 方向星系标签空中椋鸟,android,actionscript-3,starling-framework,galaxy-tab,Android,Actionscript 3,Starling Framework,Galaxy Tab,我在使用Starling框架的应用程序中工作,但我有一个问题,该应用程序适用于几乎所有类型的设备,但是当我尝试在Galaxy Tab 2中安装它时,出现了一些问题,因为默认方向是横向的,所以应用程序看起来完全杂乱无章。我试图用XML修改它,并添加一个事件来手动进行定向,但它不起作用,所以我需要帮助 我首先做的是这个 <aspectRatio>portrait</aspectRatio> <autoOrients>false</autoOrients>

我在使用Starling框架的应用程序中工作,但我有一个问题,该应用程序适用于几乎所有类型的设备,但是当我尝试在Galaxy Tab 2中安装它时,出现了一些问题,因为默认方向是横向的,所以应用程序看起来完全杂乱无章。我试图用XML修改它,并添加一个事件来手动进行定向,但它不起作用,所以我需要帮助

我首先做的是这个

<aspectRatio>portrait</aspectRatio>
<autoOrients>false</autoOrients>
<fullScreen>true</fullScreen>
<visible>true</visible>

非常感谢你

StageOrientation。倒置
StageOrientation.NORMAL
成180度角,因此,如果正常为横向,则倒置也为倒置,某些设备不支持此功能。我建议使用高度和宽度来确定绝对方向,而不是相对方向,并对此作出反应

if (stage.width > stage.height)//we are in landscape
{
    if(stage.orientation == StageOrientation.NORMAL || stage.deviceOrientation == StageOrientation.NORMAL)
    {
        stage.setOrientation(StageOrientation.ROTATED_LEFT);
    }
    else
    {
        stage.setOrientation(StageOrientation.NORMAL);
    }
}

另外值得注意的是,
stage.orientation
stage.deviceOrientation
之间有区别,你可以更详细地了解这一点

你有“如果(stage.orientation==StageOrientation.NORMAL | | stage.orientation==StageOrientation.NORMAL)”吗?@jfaron刚才我写过这篇文章,不过,我想我是想在这里介绍
deviceOrientation
,我已经更正了变量名。
if (stage.width > stage.height)//we are in landscape
{
    if(stage.orientation == StageOrientation.NORMAL || stage.deviceOrientation == StageOrientation.NORMAL)
    {
        stage.setOrientation(StageOrientation.ROTATED_LEFT);
    }
    else
    {
        stage.setOrientation(StageOrientation.NORMAL);
    }
}