Margin:

android:layout_margin:本元素离上下左右间的距离

 

android:layout_marginStart:本元素离开始的位置的距离

android:layout_marginEnd:本元素离结束位置的距离

 

android:layout_marginBottom

android:layout_marginTop

android:layout_marginLeft

android:layout_marginRight

eg:

    android:orientation="vertical"
    android:layout_height="match_parent"
    android:layout_width="match_parent">
   
            android:layout_width="800dp"
        android:layout_height="300dp"
        android:layout_margin="100dp"
        android:orientation="vertical"
        android:background="#ff0000" >      
               android:layout_width="match_parent"
        android:layout_height="match_parent"
       
        android:layout_marginTop="200dp"
        android:layout_marginBottom="50dp"
        android:layout_marginLeft="200dp"
        android:layout_marginRight="50dp"
        android:background="#00ff00"       
        />      
   

            android:layout_width="100dp"
        android:layout_height="100dp"
       
        android:layout_marginStart="-50dp"
        android:layout_marginEnd="50dp"     
        android:background="#0000ff"
       
        />

android布局属性之margin_第1张图片

由于红色部分离边框的距离是100dp,所以蓝色的上边缘没有与红色底边缘对齐。

因为蓝色的start是-50,所有我们看到的宽只有50dp。

更多相关文章

  1. Android:解决RadioGroup中RadioButton的图片自定义及每项间隔距离
  2. android线性布局控件之间的距离设置
  3. 元素可指定如下常用属性
  4. 自定义动画(animation)时set中的各元素效果
  5. android manifest.xml中元素含义android
  6. 分享html元素调用服务器实例
  7. C#如何计算传入的时间距离今天的时间差的实例分享
  8. C#通过KD树进行距离最近点的查找的实例分析

随机推荐

  1. python爬网页,做k线图
  2. python类的成员和装饰器
  3. 用python完成1-100的加法
  4. python多线程文件传输范例(C/S)
  5. [Python]PDF合成小程序PDF合成小程序
  6. 关于python return 和 print 的区别
  7. python基础练习--列表问题
  8. python list range 字符串的截取 如 text
  9. 如何将两个列表中的数据写入csv中的列?
  10. Python list 交集,并集,差集