<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. sqlserver 视图能否有变量

    不能,sqlserver 视图一般不能有变量,也不能带存储过程

  2. C#获取管理员权限

    在进行C盘的读写时,有时会需要用到管理员权限 //找到位于 Properties 下面的 app.manifest 文件 将<requestedExecutionLevel level=&quo ...

  3. 查看CentOS上Apache位置,版本,停止,启动

    查看Apache是否被安装: [root@asg11 ~]# find / -name 'httpd'/etc/sysconfig/httpd/etc/httpd/etc/logrotate.d/ht ...

  4. iOS UIWebView清除缓存

    UIWebView清除Cookie: //清除cookies NSHTTPCookie *cookie; NSHTTPCookieStorage *storage = [NSHTTPCookieSto ...

  5. How to delete expired archive log files using rman?

    he following commands will helpful to delete the expired archive log files using Oracle Recovery Man ...

  6. 微信接口请求万能函数http_request

    关键字:http_request http_request post get http request原文: http://www.cnblogs.com/txw1958/p/http_request ...

  7. Java Map 按Key排序和按Value排序

    Map排序的方式有很多种,这里记录下自己总结的两种比较常用的方式:按键排序(sort by key), 按值排序(sort by value). 1.按键排序 jdk内置的java.util包下的Tr ...

  8. 线性四叉树十进制Morton码计算示例

    线性四叉树十进制Morton码计算,具体算法描述龚健雅<地理信息系统基础>P108

  9. python多进程(三种方法)

    #!/usr/bin/env python # -*- coding:utf- -*- from multiprocessing import Pool import time def f(x): t ...

  10. 转:DLL如何导出C++的类

    由于DLL的出现是针对C语言的,本身对C++的支持不够好.所以如何从DLL中导出C++的类作为DLL的API的一部分就成了问题. 我试了一下 class __declspec(dllexport) F ...