LinearLayout-线性布局:

LinearLayout-线性布局有两个方向:水平和垂直方向。分别是通过android:orientation="horizontal"和android:orientation="vertical"来控制的

权重,也就是对控件设置 android:layout_weight的属性。这个属性的意思是分配剩余空间

比如有俩个控件,分别设置为android:layout_weight=“1”,android:layout_weight=“2”,表示控件分别占屏幕的1/3和2/3,。不过这是有一个前提的,就是建立在控件的宽度或者高度设置为0dp的情况下。

例子:

<?xml version="1.0" encoding="utf-8"?>android:orientation="vertical"    tools:context=".MainActivity" >            android:orientation="vertical" >                        weight="1"        android:orientation="horizontal" >                            

android的布局文件简介_第1张图片

RelativeLayout-相对布局

相对,顾名思义是有参照的,就是以某个兄弟组件,或者父容器来决定的(兄弟组件是在一个同一个布局里面的组件,如果是布局里一个组件参照另一个布局里的组件会出错)

android:paddingBottom:设置控件内容与控件下边缘的距离

android:paddingTop:设置控件内容与控件上边缘的距离

android:paddingLeft:设置控件内容与控件左边缘的距离

android:paddingRight:设置控件内容与控件右边缘的距离

android:layout_marginBottom:设置此控件的下边缘与其他控件的距离

android:layout_marginTop:设置此控件的上边缘与其他控件的距离

android:layout_marginLeft:设置此控件的左边缘与其他控件的距离

android:layout_marginRight:设置此控件的右边缘与其他控件的距离

 

ConstraintLayout(约束布局)

ConstraintLayout 能够灵活地定位和调整子View的大小,子 View 依靠约束关系来确定位置。

功能:

  • 相对定位 (横向:Left、Right、Start、End   ;纵向:Top、Bottom、Baseline(文本底部的基准线))
  • 外边距
  • 居中和倾向
  • 可见性的表现
  • 尺寸约束
  • Chain
  • 辅助工具

一些基本属性:

android的布局文件简介_第2张图片

 

 

更多相关文章

  1. Android 布局 LinearLayout与RelativeLayout的布局属性
  2. Android UI设计——EditText控件
  3. 3.EditText控件
  4. android 相对定位布局方向
  5. android studio常用控件
  6. Android图表控件MPAndroidChart——曲线图+柱状图 CombinedChart
  7. android studio开发 控件布局
  8. android 布局属性

随机推荐

  1. Android怎么找到最优适配资源
  2. 你真的会用Android的Dialog吗?由一个Excep
  3. live555移植到Android过程.
  4. [置顶] Android安全机制分析
  5. android studio 开发 Execution failed f
  6. [Android] Nexus 7 二代连接 Windows 7
  7. android 模拟器访问本机http服务IP地址问
  8. Android程序员学IOS-UI篇
  9. android listview的创建及行删除操作
  10. Android实现悬浮图片