我想要3個按鈕對齊(左,中,右)。我知道它可以用重力來完成,但我試圖理解這裏的layout_weight概念。我正在使用此代碼:爲什麼按鈕伸展覆蓋分配的所有layout_weight
<LinearLayout
id=..
layout_width = "wrap_content"
layout_height = "wrap_content"
orientation="Horizonta"
>
<Button
id=1
layout_width = "wrap_content"
layout_height = "wrap_content"
layout_weight = "1"
text= "text" />
<Button
id=2
layout_width = "wrap_content"
layout_height = "wrap_content"
layout_weight = "1"
text= "text" />
<Button
id=3
layout_width = "wrap_content"
layout_height = "wrap_content"
layout_weight = "1"
text= "text" />
</LinearLayout>
但是,我正在獲取下面圖像的頂部。哪個是對的。問題是爲什麼在我使用wrap_content的時候,按鈕被拉伸以覆蓋它所分配的所有區域?如何使它像BOTTOM圖像?
謝謝
謝謝!我已經在這裏工作了兩個小時了! – 2016-03-10 00:52:01