<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.fingergame.MainActivity"
tools:ignore="MergeRootFrame" >
<!-- 注释不能写在</>标记内 -->
<!-- android:layout_width="fill_parent"这与父组件左右对齐属性结合的效果一致-->
<TextView
android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:gravity="center_horizontal"
android:textSize="20sp"
android:textColor="#0000FF"
android:text="猜 拳 游 戏"
/> <ImageView
android:id="@+id/photo1"
android:layout_below="@id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:layout_marginLeft="60dp"
android:src="@drawable/smileface"
/> <ImageView
android:id="@+id/photo2"
android:layout_below="@id/title"
android:layout_toRightOf="@id/photo1"
android:layout_marginTop="18dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="80dp"
android:src="@drawable/smileface"
/>
<RadioGroup
android:id="@+id/chose1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:layout_marginLeft="40dp"
android:layout_below="@id/photo1"
android:orientation="vertical"
> <RadioButton
android:id="@+id/stone1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/photo1"
android:layout_toRightOf="@+id/chose1"
android:layout_marginTop="20dp"
android:checked="true"
android:text="石头" /> <RadioButton
android:id="@+id/scissors1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/stone1"
android:layout_marginTop="20dp"
android:layout_toRightOf="@+id/chose1"
android:text="剪刀" /> <RadioButton
android:id="@+id/cloth1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/scissors1"
android:layout_marginTop="20dp"
android:layout_toRightOf="@+id/chose1"
android:text="布" />
</RadioGroup> <!-- android:layout_height="wrap_content"以chose1的头部对齐
比用android:layout_marginTop="20dp"更灵活 -->
<RadioGroup
android:id="@+id/chose2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/chose1"
android:layout_marginLeft="70dp"
android:layout_toRightOf="@+id/photo1"
android:orientation="vertical" > <RadioButton
android:id="@+id/stone2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/chose1"
android:layout_marginTop="20dp"
android:layout_toRightOf="@+id/stone1"
android:checked="true"
android:text="石头" /> <RadioButton
android:id="@+id/scissors2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/stone2"
android:layout_marginTop="20dp"
android:layout_toRightOf="@+id/scissors1"
android:text="剪刀" /> <RadioButton
android:id="@+id/cloth2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/cloth1"
android:layout_marginTop="20dp"
android:layout_toRightOf="@+id/cloth1"
android:text="布" />
</RadioGroup> <Button
android:id="@+id/ok1"
android:layout_width="75dp"
android:layout_height="35dp"
android:layout_below="@+id/chose1"
android:layout_marginTop="20dp"
android:layout_alignLeft="@+id/chose1"
android:text="确认"
/> <Button
android:id="@+id/ok2"
android:layout_width="75dp"
android:layout_height="35dp"
android:layout_below="@+id/chose2"
android:layout_marginTop="20dp"
android:layout_alignLeft="@+id/chose2"
android:text="确认"
/> <TextView
android:id="@+id/copyright"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="5dp"
android:text="©fingergame 2015 | designer:Amy" /> </RelativeLayout>

  运行结果:

Android相对布局实例的更多相关文章

  1. [转]Android:布局实例之模仿QQ登录界面

    Android:布局实例之模仿QQ登录界面 预览图: 准备: 1.找到模仿对象 QQ登陆界面UI下载>>>>> 2.导入工程 3.查看布局结构和使用控件 其对应效果图分布 ...

  2. Android:布局实例之模仿QQ登录界面

    预览图: 准备: 1.找到模仿对象 QQ登陆界面UI下载>>>>> 2.导入工程 3.查看布局结构和使用控件 其对应效果图分布为 4.分析样式选择器 下拉箭头2种样式:点 ...

  3. Android:布局实例之模仿京东登录界面

    预览图及布局结构参考: 布局: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout ...

  4. Android:布局实例之模仿微信Tab

    微信Tab预览效果: 思路: 1.用TabHost+RadioGroup搭建基本布局,以RadioGroup代替TabWidget 2.设置按钮和文字的的样式和selector 3.创建相应的Acti ...

  5. Android:布局实例之常见用户设置界面

    实现效果: 整理思路: 1.控件:文字TextView 和 右箭头ImageView 2.因为考虑到点击效果,设计为:最外层为全圆角,内层有四种情况,分别为上圆角.无圆角.下圆角和全圆角. 3.内层样 ...

  6. Android:布局合集

    本文归纳Android布局中所用到的知识点,网络上的教程说得太细化,而对于前端来说,下面的归纳最适合不过了. Android五大布局: LinearLayout 线性布局 Relativelayout ...

  7. Android基本布局

    android基本布局有三种:LinearLayout,RelativeLayout,FrameLayout. 一.LinearLayout 1,这是一种垂直布局(或者水平布局),可以通过下面这一句来 ...

  8. Android课程---布局管理器中的线性布局

    线性布局实例: <?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:andro ...

  9. Android开发--布局二

    1.Andrid:控件布局(表格布局)TableLayout 有多少个TableRow对象就有多少行, 列数等于最多子控件的TableRow的列数 直接在TableLayout加控件,控件会占据一行 ...

随机推荐

  1. JavaScript: JavaScript的简介和入门代码演示

    1.Javascript的发展历史介绍: javascript是指的实在网页上编写的编程语言,其主要是控制器html的动态显示效果.HTMl能带来的只是一些基本的页面的风格,而要展示的漂亮使用CSS, ...

  2. saltstack之(五)数据系统Grains和Pillar

    一.grains 1.什么是grainsgrains:存储minion端的信息,包括一些网络.硬件等信息,保存在minion端.一般为静态信息,非经常变化的数据. 2.grains的使用:获取mini ...

  3. Linux和Windows路由配置

    Linux和Windows路由配置 一.配置路由 1-       原则上一台主机只能有一条缺省路由.如果一台主机上有多个网段的话,请配置能够上网的那个网段的网关为缺省路由 Linux配置缺省路由: ...

  4. 使用Storm实现实时大数据分析

    摘要:随着数据体积的越来越大,实时处理成为了许多机构需要面对的首要挑战.Shruthi Kumar和Siddharth Patankar在Dr.Dobb’s上结合了汽车超速监视,为我们演示了使用Sto ...

  5. [BS] 小知识点总结-01

    1. UIImageView *imgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"MainTitle&quo ...

  6. 深入理解CSS3 Animation 帧动画 ( steps )

    作者:Aaron的博客 网址:http://www.cnblogs.com/aaronjs/p/4642015.html --------------------------------------- ...

  7. 12c Grid Infrastructure Management Repository (GIMR)

    1.什么是管理资料库(Management Repository) 管理资料库是12c中oracle clusterware管理的一个单实例数据库.对应的数据库名是MGMTDB.因为是一个单实例数据库 ...

  8. Oracle 12C -- 使用seed PDB创建新的pdb

    $ sqlplus '/as sysdba' SQL*Plus: Release Production on Tue Jun :: Copyright (c) , , Oracle. All righ ...

  9. java学习材料

    java资料大全 http://zz563143188.iteye.com/ it男视野扩展资料 HTTP://WLSAM168.400GB.COM 最全 spring mvc http://jinn ...

  10. Swift游戏实战-跑酷熊猫 14 熊猫打滚

    这节内容我们来实现熊猫打滚.思路是这样的,当熊猫起跳时记录他的Y坐标,落到平台上的时候再记录它的Y坐标.两个坐标之间的差要是大于一定数值就判断它从高处落下要进行打滚缓冲.至此跑酷熊猫已经像一个游戏的样 ...