开发者

Issues with padding in RelativeLayout

开发者 https://www.devze.com 2023-01-20 13:55 出处:网络
<View android:id=\"@+id/first_sep\" android:layout_width=\"fill_parent\" android:layout_height=\"1dip\"
<View
  android:id="@+id/first_sep"
  android:layout_width="fill_parent"
  android:layout_height="1dip"
  android:paddingTop="100dip"
  android:layout_below="@id/calculate"
  android:background="#FFCCCCCC" />

I ha开发者_JAVA技巧ve this View in a RelativeLayout and the android:paddingTop property doesn't seem to work. Tried it with various values and still the View lies close to the Button "calculate".


As MGS indicates, you probably want android:layout_marginTop, or perhaps android:layout_height=101dip. I am uncertain if padding has any meaning on a generic View. If it is supported, it certainly will have no difference than simply setting the height to include the padding, since padding is considered part of the background calcluations.

For space between a widget and an adjacent widget, use margins. For space between the edges of a widget and its contents (e.g., between the edge of a Button and its caption), use padding. In the case of a transparent background, these will visually be identical. In the case of a non-transparent background, they will be substantially different visually.

0

精彩评论

暂无评论...
验证码 换一张
取 消