android的布局属性中padding和margin的区别
来源:互联网 发布:淘宝店能出售吗 编辑:程序博客网 时间:2024/05/14 15:38
google的android文档里的解释:
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有边缘,页面留白的意思
借用一幅别人的图来说明
public static final int padding
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.
android:layout_marginBottom
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属性的区别和详解
- 求出两个序列的最长公共子序列
- eeeeeeeeeeee
- 求解数组中最长递增自序列
- 编程之美2.17 数组循环移位
- 回溯法求解n皇后
- android的布局属性中padding和margin的区别
- NT环境下进程隐藏的实现
- JAVA高级02_01 File类 2011-4-22
- 解决jetty启动后不能修改静态文件的问题
- c# word操作
- cabbage Linux 学习之路基础篇之 文件与目录
- .关机助手,很好用的Windows桌面关机小工具(免费版)
- 给window加样式
- Extjs 支持图片上传的Html编辑器(StarHtmleditor)及其bug修正