并排带有两个按钮的线性布局-android [英] Linear Layout with two buttons side by side - android
本文介绍了并排带有两个按钮的线性布局-android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在下面的三个按钮中分别显示了layout.xml ...
I have 3 buttons the layout.xml below where they appear below of each other...
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dip" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/btn_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Car" />
<Button
android:id="@+id/btn_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Vehicle" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:id="@+id/btn_3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Bike" />
</LinearLayout>
</LinearLayout>
我想将前两个按钮(btn_1和btn_2)并排放置.有人可以给我提示如何做吗?
I would like to have the first two buttons side by side (btn_1 and btn_2). Could anybody give me a hint about how to do that???
非常感谢
推荐答案
只需将布局的android:orientation="vertical"
更改为android:orientation="horizontal"
,一切都会正常
just change android:orientation="vertical"
to android:orientation="horizontal"
of your layout and every thing will work fine
这篇关于并排带有两个按钮的线性布局-android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文