安卓方向不起作用



我正在制作一个Android应用。我的屏幕没有改变活动的方向。三星袋上的Android版本为2.3.6。

遵循布局屏幕。

编辑:对不起,下面的标签头丢失了,因为它是在线下方,如何看到XML丢失的部分。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >
    <EditText android:id="@+id/edit_message"
        android:layout_weight="1"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:hint="@string/edit_message" />
    <Button android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/button_send"
        android:onClick="sendMessage" />
</LinearLayout>

和AndroidManifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myfirstapp"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/CustomActionBarTheme">
        <activity
            android:name="com.example.myfirstapp.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:theme="@style/Custom2ActionBarTheme"
            android:name="com.example.myfirstapp.DisplayMessageActivity"
            android:label="@string/title_activity_display_message"
            android:parentActivityName="com.example.myfirstapp.MainActivity" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.example.myfirstapp.MainActivity" />
        </activity>
    </application>
</manifest>

我不知道该怎么办,我通过Google寻找解决方案,但找不到答案。

帮助

此电话:http://www.samsung.com/hk_en/consumer/mobile/mobile-phones/mobile-phones/smartphone/gt-s5300zkatgy-features

知道它的方向改变了它肯定有传感器吗?在您的设置中,自动旋转是否关闭?

我看不到您发布的内容,我知道会停止方向更改。

当其他答案提到 - 首先,您需要检查手机是否具有功能,然后检查以查看您在Android中没有设置。

在您的应用程序中," RED"下的"布局"文件夹 - 您有一个"布局 - 陆地"文件夹,在该文件夹中定义了指定景观布局的布局文件。

创建一个布局 - 地面目录(在" res"文件夹下),然后将布局XML文件的景观版本放在该目录中。

最新更新