RelativeLayout 相对布局
效果如下:




<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="fill_parent">    <TextView        android:id="@+id/label"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:text="Type here:"/>    <EditText        android:id="@+id/entry"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:background="@android:drawable/editbox_background"        android:layout_below="@id/label"/>    <Button        android:id="@+id/ok"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_below="@id/entry"        android:layout_alignParentRight="true"        android:layout_marginLeft="10dip"        android:text="OK" />    <Button        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_toLeftOf="@id/ok"        android:layout_alignTop="@id/ok"        android:text="Cancel" /></RelativeLayout><!--       RelativeLayout 的相关的属性    相对布局             第一类 :属性值为true 和false 的:      android:layout_centerHrizontal      水平居中      android:layout_centerVertial        垂直居中      android:layout_centerInparent       相对于父元素完全居中      android:layout_alignParentBottom    贴紧父元素的下边缘      android:layout_alignParentLeft      贴紧父元素的左边缘      android:layout_alignParentRight     贴紧父元素的右边缘      android:layout_alignParentTop       贴父元素的上边缘      android:layout_alignWithParentIfMissing     如果对应的兄弟元素找不到的话就以父元素作为参照物                  第二类:属性值必须为id的引用名,"@id/id-name"   就是参照的元素id      android:layout_below        在某元素的下方      android:layout_above        在某元素的上方      android:layout_toLeftOf     在某元素的左边      android:layout_toRigthOf    在某元素的右边      android:layout_alignTop     本元素的上边缘和某元素的上边缘对齐      android:layout_alignLeft    本元素的左边缘和某元素的左边缘对齐      android:layout_alignBottom  本元素的下边缘和某元素的下边缘对齐      android:layout_alignRigth   本元素的右边缘和某元素的右边缘对齐            第三类的:属性的值为具体的像素的值: 如:20dip  , 50px      android:layout_marginBottom     离某元素底边缘的距离      android:layout_marginLeft       离某元素左边缘的距离      android:layout_marginRigth      离某元素右边缘的距离      android:layout_marginTop        离某元素上边缘的距离  -->  

更多相关文章

  1. RelativeLayout常用属性介绍
  2. Android布局属性详解
  3. XamarinAndroid组件教程RecylerView动画组件使用动画(3)
  4. 四大布局
  5. LinearLayout和RelativeLayout 属性对比
  6. Relative Layout 中用到的一些属性
  7. android学习笔记20--------------RelativeLayout的使用
  8. 安卓中的布局属性详解
  9. 优酷菜单

随机推荐

  1. Android(安卓)自定义dialog
  2. Android(安卓)验证输入的必须为汉字
  3. 【Appium】架构简单分析
  4. android 2.2 视频和图片的缩略图处理
  5. Android中两种设置全屏的方法!!!
  6. android adb shell 的ls命令出现奇怪的字
  7. android 中bitmap与String(base64) byte[]
  8. Android(安卓)更新和安装
  9. android linux 基础知识总结(1)
  10. 编译Coco2d-x android 程序出现make: ***