0

私は自分のアプリケーションを横向きモードで配置していますmanifest:

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:screenOrientation="landscape"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
    <activity
        android:name=".VerticalSlideshow"
        android:label="@string/title_activity_prime" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />

私は、背景にFrameLayout垂直を含み、前景にいくつかのボタンがあり、ScrollViewうまくハミングしています。エミュレーターを使用して前景画像/ボタンが横向きモードにならないことを除いて、すべて正常に機能します。これが私のコードです:LinearLayoutImageView

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ddffff" >

<ScrollView
    android:id="@+id/horizontal_scrollview_id"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:fadingEdge="none" >

    <LinearLayout
        android:id="@+id/horiztonal_outer_layout_id"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:orientation="vertical"
        android:paddingBottom="0dp"
        android:paddingTop="0dp" >
    </LinearLayout>
</ScrollView>

<LinearLayout
    android:id="@+id/moving"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center_horizontal"
    android:background="@drawable/clear"
    android:gravity="center_horizontal"
    android:orientation="horizontal" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/truck1" />

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_gravity="right"
        android:layout_weight="0.12"
        android:gravity="right"
        android:orientation="vertical" >

        <ImageButton
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="0.25"
            android:background="@drawable/carfs"
            android:src="@drawable/clear" />

        <ImageButton
            android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="0.25"
            android:background="@drawable/policef"
            android:src="@drawable/clear" />

        <ImageButton
            android:id="@+id/button3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="0.25"
            android:background="@drawable/taxif"
            android:src="@drawable/clear" />

        <ImageButton
            android:id="@+id/button4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="0.25"
            android:background="@drawable/amulancef"
            android:src="@drawable/clear" />
    </LinearLayout>
</LinearLayout>

</FrameLayout>

Eclipse の XML プレビューは問題ないようです。実際の電話でテストする必要がありますか? 最終的に、このリニアビューをランドスケープに強制するにはどうすればよいですか?

4

1 に答える 1

1

マニフェスト ファイルのアプリケーション タグではなく、アクティビティ タグに android:screenOrientation="landscape" を挿入してみてください

于 2012-08-18T15:25:13.883 に答える