简体   繁体   中英

what does “android:padding=-5dp” mean?

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM