0

私のユーザーインターフェイスは、ランドスケープモードで次のようになります。

ここに画像の説明を入力

しかし、私はそれらを並行させたいと思っています。したがって、高さ/ 2ではなく幅/ 2が必要です。それを変更するにはどうすればよいですか?

私のコードは次のようになります。

<FrameLayout 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:background="#ffffff">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <Button
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/photo"
            android:layout_weight="0.5"
            android:id="@+id/btnTakePhoto" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/video"
            android:layout_weight="0.5"
            android:id="@+id/btnRecordVideo"
            />

    </LinearLayout>
</FrameLayout>

よろしくお願いします。

4

1 に答える 1

0

app ディレクトリのresフォルダーにlayout-landフォルダーを追加し、このフォルダーに同じ名前の xml を設計します。Android フレームワークはモードを検出し、layout-land フォルダー内で定義されたレイアウト ファイルを選択します。

* layoutと layout-land フォルダーのxml ファイル名は同じである必要があります。

于 2016-11-20T21:27:09.520 に答える