2012-06-23 18 views

回答

34

放一個android:layout_margin="10dp"上的ImageButton,與

android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
+0

非常感謝! –

+0

感謝您的簡單問題:) – you786

+0

不錯!謝謝 –

5
  1. 使用沿着XML屬性android:layout_marginLeft到指定的視圖左側額外 空間。
  2. 使用xml屬性android:layout_marginRight在視圖右側指定 額外空間。
  3. 使用xml屬性android:layout_marginTop指定視圖頂部的額外 空間。
  4. 使用xml屬性android:layout_marginBottom在視圖底部指定 額外空間。
  5. 使用xml屬性android:layout_margin指定視圖左側,頂部,右側和底部的額外 空間。

在你的情況你的ImageButton的聲明看起來是這樣

<ImageButton 
    android:id="@+id/button1" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:text="Button" 
    android:layout_marginLeft="15dp" 
    android:layout_marginRight="15dp" 
    android:src="@drawable/a"