Padding and margin are often used when arranging control layouts on Android.
Its specific explanation can be shown by a graph, as below,
Two properties represent the same meaning as Web programming.
Deep Understanding:
Padding constrains the distance the control or layout displays from the bounding rectangle, compressing it inward along the vertical border, and the larger the padding, the smaller the content display control;
Margin this is the distance extending outward along the vertical border, which means to add a certain distance to the control of the blank edge, the display effect only with the value of positive and negative correlation, and other element bounds independent.
It is worth noting that the range of the padding value [0, any positive number] (the default is 0), and the value of margin has a positive negative.
To understand negative values, the first thing to understand is the 0 value, when the margin= "0dip", the control extension of the edge is 0, that is, the boundary next to the other edge;
Margin>0, is to add white edge to the control, so that its extension becomes larger, when too large will affect the entire control display size;
Margin<0, typically used in a single-direction display, that is, the distance between the control and its neighboring controls is negative, from the display is to overwrite the other controls in one direction.
In general, these two properties are properties of a control that control only the display of the control, the meaning of which is also not involved in the parent control or other neighboring controls, so be aware of, do not confuse.
start and end are the relative concepts of change, as follows,
- Paddingstart & Paddingend Works according to the right and left alignment (level-api-17 )
- When left aligned, Paddingstart corresponds to Paddingleft, paddingend corresponds to Paddingright
- Right-aligned, just the opposite
The above personal understanding, reproduced annotated source, thank you.