Difference between a View's Padding and Margin

来源:互联网 发布:ios版狂野飙车同步数据 编辑:程序博客网 时间:2024/06/03 11:11

92
down voteaccepted

Padding is the space inside the border, between the border and the actual view's content. Note that padding goes completely around the content: there is padding on the top, bottom, right and left sides (which can be independent).

Margins are the spaces outside the border, between the border and the other elements next to this view. In the image, the margin is the grey area outside the entire object. Note that, like the padding, the margin goes completely around the content: there are margins on the top, bottom, right, and left sides.

An image says more than 1000 words:

alt text

原创粉丝点击