RelativeLayout顾名思义就是根据各个控件之间的关系进行布局

和容器间的关系:
android:layout_alignParentTop

says the widget's top should align with the top of the container


android:layout_alignParentBottom

says the widget's bottom should align with the bottom of the container


android:layout_alignParentLeft

says the widget's left side should align with the left side of the container


android:layout_alignParentRight

says the widget's right side should align with the right side of the container


android:layout_centerHorizontal

says the widget should be positioned horizontally at the center of the container


android:layout_centerVertical

says the widget should be positioned vertically at the center of the container


android:layout_centerInParent

says the widget should be positioned both horizontally and vertically at the center of the container

以上各个属性的值都为boolean值类型

当你需要引用另外一个控件的属性值时,可通过@id/widget_a.property进行引用

和其他控件间的关系:

android:layout_above

indicates that the widget should be placed above the widget referenced in the property


android:layout_below

indicates that the widget should be placed below the widget referenced in the property


android:layout_toLeft

indicates that the widget should be placed to the left of the widget referenced in the property


android:layout_toRight

indicates that the widget should be placed to the right of the widget referenced in the property

android:layout_alignTop

indicates that the widget's top should be aligned with the top of the widget referenced in the property


android:layout_alignBottom

indicates that the widget's bottom should be aligned with the bottom of the widget referenced in the
property


android:layout_alignLeft

indicates that the widget's left should be aligned with the left of the widget referenced in the property


android:layout_alignRight

indicates that the widget's right should be aligned with the right of the widget referenced in the property


android:layout_alignBaseline

indicates that the baselines of the two widgets should be aligned

假如我们需要将控件B放在控件A的右边,我们可以这样进行设置

在控件B上写上:android:layout_toRight ="@id/widget_a"

更多相关文章

  1. android 自定义控件(邮箱边写边出格式邮箱)
  2. 自定义控件--虚线
  3. Android(安卓)自绘输入框
  4. android之4.0控件switch自定义开关滑块、滑块轨道和宽度
  5. Android中WebView控件的使用
  6. android 五种 布局文件
  7. Android(安卓)Studio 新建编辑条 点击按钮显示控件中的内容
  8. android 关于listview scrollview 底部 控件无法显示的两个解决
  9. Android(安卓)- Navigation

随机推荐

  1. Android frambuffer 驱动的简要解析
  2. 学习到的有关android的知识点 单元测试等
  3. Android 解决多个通知发生冲突的问题
  4. QT开始支持andriod和ios
  5. Android 实现Toast的快速切换刷新
  6. Android自定义dialog弹出布局
  7. Android Sqlite数据库查询操作使用 '%?%'
  8. Android Inflate
  9. Android Audio代码分析19 - setPosition
  10. Android设置Button保持Press的状态