Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issues with padding in RelativeLayout

<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 have 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".

like image 262
Ragunath Jawahar Avatar asked Dec 10 '22 13:12

Ragunath Jawahar


1 Answers

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.

like image 152
CommonsWare Avatar answered Dec 20 '22 08:12

CommonsWare