Paddings are always applied by the view itself.
On all four sides
android:padding = "8dp"
On each side
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
Margins are defined in a view but are applied by the parent view. So they need a parent "GroupView" in order to be applied.
On all four sides
android:layout_margin = "8dp"
On each side
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
Tips:
- To remember that margin is applied by the parent view, remember that its definition starts with "layou"
- Use 8dp increments, as it is recommended by material design.
- Margins of adjacent views do not collapse (as in HTML). So 16dp margin on each view means 2x16dp = 32dp between them.