0

I'm inspecting some old android layout:

and i see this attribute in a customView

android:padding="-5dp"

what does this mean?

(a) when coming alone?

(b) when android:paddingTop="-5dp" comes after android:padding="10dp" does this mean all paddings are 10 and the top is 5dp ?

attention

please note I'm asking specifically about negative value, not padding in general

Elad Benda2
  • 13,852
  • 29
  • 82
  • 157

2 Answers2

2

a) I think these two links will help you: Effects of Negative padding and Is it a bad practice to use negative margins in Android?

b) You are right, all paddings are set to 10dp first, then padding-top is set to -5dp. You "overwrite" the 10dp with the -5dp.

Community
  • 1
  • 1
Manuel Allenspach
  • 12,467
  • 14
  • 54
  • 76
-1

Padding is the space between the view border and the content inside the view. when you say padding , it means padding in all directions (Top, left, bottom and right). when you say paddingTop , means padding only from the top.

MSaudi
  • 4,442
  • 2
  • 40
  • 65