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"
分享到:
相关推荐
自定义RelativeLayout圆角图片背景,自定义属性 背景 圆角半径
Android 相对布局 RelativeLayout 属性
android实现自定义RelativeLayout可拖动、缩放、旋转TextView
总结android中相对布局RelativeLayout的所有属性及使用方法。适合初级程序员
Android布局入门,LinearLayout和RelativeLayout的理解和应用
Android RelativeLayout 的翻译应用。希望能给大家帮助
android布局属性RelativeLayout详解.
介绍一下RelativeLayout的一些属性,针对于刚学习android开发的朋友
LinearLayout与RelativeLayout混合用
Android相对布局RelativeLayout的基本用法,相对布局是最实用的布局。
安卓动态控制RelativeLayout的组件
DragView 可拖拽的view,继承自RelativeLayout
【Android开发学习25】界面布局之相对布局RelativeLayout(代码)
像 RelativeLayout 一样的 RadioGroup
一个Android XML布局的例子,主要利用xml文件进行布局,里边用到的是RelativeLayout。具体的本例中: 非洲草原地图:用到了FrameLayout的使用;ActivityMain演示了linerLayout。 个性化表单ActivityLayout 演示...
LinearLayout和RelativeLayout实现精确布局-简单版 类似与应用评价
根据ScrollView的自定义实现 RelativeLayout跟随手势的上下滑动显示和隐藏顶部标题栏,话不多说 直接上代码
介绍了android 中 RelativeLayout 下的各种属性。linux下打开.
Android中使用RelativeLayout布局完成的登录界面教学案例任务说明.pdf 学习资料 复习资料 教学资源