親コンテナーの幅ImageButton
を埋めたいのですが、マイナス数を引いて、左右のパディングがあります。試してみましたが、エラーが発生してレンダリングされません。RelativeLayout
dp
fill_parent-10dp
21207 次
2 に答える
46
android:layout_margin="10dp"
とともに、ImageButtonに
android:layout_width="fill_parent"
android:layout_height="fill_parent"
于 2012-06-23T02:15:57.630 に答える
10
- xml 属性
android:layout_marginLeft
を使用して、ビューの左側に余分なスペースを指定します。 - xml 属性
android:layout_marginRight
を使用して、ビューの右側に余分なスペースを指定します。 - xml 属性
android:layout_marginTop
を使用して、ビューの上部に余分なスペースを指定します。 - xml 属性
android:layout_marginBottom
を使用して、ビューの下側に余分なスペースを指定します。 - 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"
于 2012-06-23T02:45:50.830 に答える