在两侧的android中将方向设置为横向

在两侧的android中将方向设置为横向,android,android-orientation,Android,Android Orientation,我在2.2版本的android应用程序中工作,我想将我的应用程序设置为横向模式 为此,我在我的清单中添加了每个活动标签android:screenOrientation=“scape”,效果很好 但它只有一面。如果我再次将设备倒置,它将在横向模式下安装在相同的位置。如何在设备的两侧设置横向模式。请帮帮我 提前谢谢。试试这个 android:screenOrientation="reverseLandscape" 我不确定2.2的情况,但如果您正在为Android 2.3及更新版本构建应用程序,

我在2.2版本的android应用程序中工作,我想将我的应用程序设置为
横向
模式

为此,我在我的
清单中添加了每个活动标签
android:screenOrientation=“scape”
,效果很好

但它只有一面。如果我再次将设备倒置,它将在
横向模式下安装在相同的位置。如何在设备的两侧设置横向模式。请帮帮我

提前谢谢。

试试这个

android:screenOrientation="reverseLandscape"

我不确定2.2的情况,但如果您正在为Android 2.3及更新版本构建应用程序,您可以在活动清单中进行设置

android:screenOrientation="sensorLandscape"
如果您正在为Android 2.2及更高版本构建应用程序,但希望在Android 2.3及更高版本上以“传感器景观”配置运行它,您可以尝试以下方法

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
    }

使用这个,我想它会帮助你

addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, onOrientationChange);

function onOrientationChange(event:StageOrientationEvent):void {
     trace("onOrientationChange:"+event.afterOrientation);
    ...and process result.
    }
}

要使Android应用程序仅以横向模式显示,请将此行添加到AndroidManifest.xml文件中的活动定义中:

android:screenOrientation="landscape"
例如,这是Android清单文件中我的主要活动的定义:

<activity
    android:name=".MainActivity"
    android:screenOrientation="landscape"
    android:label="@string/app_name" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>


在android 2.2中,我没有在活动标签中获得android中名为reverseLandscape:screenOrientation的属性。您是在哪个版本中获取此属性的。哦,对不起,由于API级别为9(适用于android 2.3),因此无法使用此属性。对不起。我试过了,发现对我的场景不起作用。Eclair和Froyo只在一边做。Gingerbread和更高版本可以在两个方面都实现。在android 2.2中有没有其他方法可以实现这种可编程性?它可以旋转视图,但不会触发任何事件。我需要捕捉方向从正常视图变为反向视图时的事件。怎么做?