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 文件夹中定义的布局文件。

*记住布局和布局文件夹中的xml文件名应该相同。

于 2016-11-20T21:27:09.520 回答