您的位置:首页 > 移动开发 > Android开发

[Android] Different between Padding and Margin in Layout

2011-05-04 14:17 621 查看
The original descriptions in Android

* Padding

The padding is expressed in pixels for the left, top, right and bottom parts of the view. Padding can be used to offset the content of the view by a specific amount of pixels.

* Margin

Specifies extra space on the bottom side of this view. This space is outside this view's bounds.

In brief speaking,

* A Padding is used inside of the View to shift contents in it.
* A Margin is used outside of the View for a ViewGroup to layout the empty space at the side of child

PS.
1. To measure its dimensions, a view takes into account its padding.
2. Even though a view can define a padding, it does not provide any support for margins. However, view groups provide such a support.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: