Android:如何更改将屏幕分成3个相等的按钮 [英] Android: How to change divide the screen in 3 equal buttons
本文介绍了Android:如何更改将屏幕分成3个相等的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在布局中有3个按钮.我想做的是增加按钮的大小,以便它们覆盖整个屏幕.如何在xml文件中做到这一点?
I have 3 buttons in a layout. What I want to do is increase the size of the buttons so they fill the entire screen. How can I do that in the xml file?
推荐答案
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button"
android:layout_weight="1"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button2"
android:layout_weight="1"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button3"
android:layout_weight="1"/>
</LinearLayout>
您需要weightSum
You need weightSum
这篇关于Android:如何更改将屏幕分成3个相等的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文