【发布时间】:2016-11-20 21:08:38
【问题描述】:
我的用户界面在横向模式下是这样的:
但我想让它们并行。所以应该有宽度/ 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>
提前感谢您的帮助!
【问题讨论】:
-
如果我正确理解您的问题,您可以将
LinearLayout的方向设置为horizontal:android:orientation="horizontal" -
谢谢,不知道这么简单!
标签: android android-layout autosize stretched