Android的布局属性中padding和margin的区别
来源:互联网 发布:metropolis算法 编辑:程序博客网 时间:2024/06/09 17:12
public static final int padding
Since: API Level 1
Sets the padding, in pixels, of all four edges. Padding is defined as space between the edges of the view and the view's content. A views size will include it's padding. If a background is provided, the padding will initially be set to that (0 if the drawable does not have padding). Explicitly setting a padding value will override the corresponding padding found in the background.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters).
This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.
Constant Value: 16842965 (0x010100d5)
再看margin,以marginBottom 举例
android:layout_marginBottom
Since: API Level
Specifies extra space on the bottom side of this view. This space is outside this view's bounds.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters).
This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.
This corresponds to the global attribute resource symbol layout_marginBottom.
Related Methods
setMargins(int,int,int,int)
所以padding是定义控件自己的内容和控件边缘之间的距离,padding有填充填料的意思,而margin是在说控件的四个边缘之外的距离,指的是和别的控件之间的距离,margin有边缘,页面留白的意思
借用一幅别人的图来说明
- android的布局属性中padding和margin的区别
- Android的布局属性中padding和margin的区别
- android布局中有关margin和padding的区别
- android布局中margin和padding的区别!
- Android布局中margin,padding,align的用法和区别
- android中padding和margin的区别
- Android 中padding和margin的区别
- Android中margin和padding的区别
- Android中margin和padding的区别
- Android中margin和padding的区别
- Android中margin和padding的区别
- Android中padding和margin的区别
- Android布局中Padding与Margin的区别
- Android布局中margin与padding的区别
- Android布局padding与margin的区别
- CSS中Margin和padding属性的区别
- CSS中Margin和padding属性的区别
- css中padding、margin属性的区别和详解
- matalab中的rand函数
- 十五个经典算法研究与总结学习笔记之A*搜索算法1
- 智能手环Gear Fit评测:看上去很美好
- 四月新影片扎堆 即将上映7部电影大推荐
- 开源项目学习方法[转]
- Android的布局属性中padding和margin的区别
- 几个比较重要的xml绘制按钮selector
- 好的用户界面-界面设计的一些技巧
- 诺基亚WP8.1曝光:重点优化拍照性能
- delete from file$ where file#=5
- 九宫格中联系人字符匹配算法简析
- 【iOS】iOS中CGLayer解释
- 看看SRI的“可穿戴机器人”:能让人跑得更快、负重更多的可穿戴技术(视频)
- 黑马程序员 自学10C#编程基础之结构和数组