|
如果想在畫面的「某一列」,放2個按鈕,而這2個按鈕要平均分配寬度,程式如下:
<Button android:id="@+id/button1" android:layout_height="wrap_content" android:text="delete" android:layout_width="fill_parent" android:layout_weight="1"/>
<Button android:id="@+id/button2" android:layout_height="wrap_content" android:text="unlink" android:layout_width="fill_parent" android:layout_weight="1"/>
如果不要按鈕之間有留白,以下3種作法
(1) 把padding設負值
(2) 給Button 設android:background="#000" 隨便給一個顏色,但是高度會變小,要自己設一下
(3) 自己做一張.png圖,給Button 設android:background="X圖"
|
|