Difference between a View's Padding and Margin

后端 未结 14 2918
渐次进展
渐次进展 2020-11-22 06:45

What is the difference between a View\'s Margin and Padding?

14条回答
  •  再見小時候
    2020-11-22 07:08

    Padding
    Padding is inside of a View.For example if you give android:paddingLeft=20dp, then the items inside the view will arrange with 20dp width from left.You can also use paddingRight, paddingBottom, paddingTop which are to give padding from right, bottom and top respectively.

    Margin
    Margin is outside of a View. For example if you give android:marginLeft=20dp , then the view will be arranged after 20dp from left.

提交回复
热议问题