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.
[Android] Different between Padding and Margin in Layout
最新推荐文章于 2025-09-04 16:51:32 发布
