Android相对布局实例
<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相对布局实例的更多相关文章
- [转]Android:布局实例之模仿QQ登录界面
Android:布局实例之模仿QQ登录界面 预览图: 准备: 1.找到模仿对象 QQ登陆界面UI下载>>>>> 2.导入工程 3.查看布局结构和使用控件 其对应效果图分布 ...
- Android:布局实例之模仿QQ登录界面
预览图: 准备: 1.找到模仿对象 QQ登陆界面UI下载>>>>> 2.导入工程 3.查看布局结构和使用控件 其对应效果图分布为 4.分析样式选择器 下拉箭头2种样式:点 ...
- Android:布局实例之模仿京东登录界面
预览图及布局结构参考: 布局: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout ...
- Android:布局实例之模仿微信Tab
微信Tab预览效果: 思路: 1.用TabHost+RadioGroup搭建基本布局,以RadioGroup代替TabWidget 2.设置按钮和文字的的样式和selector 3.创建相应的Acti ...
- Android:布局实例之常见用户设置界面
实现效果: 整理思路: 1.控件:文字TextView 和 右箭头ImageView 2.因为考虑到点击效果,设计为:最外层为全圆角,内层有四种情况,分别为上圆角.无圆角.下圆角和全圆角. 3.内层样 ...
- Android:布局合集
本文归纳Android布局中所用到的知识点,网络上的教程说得太细化,而对于前端来说,下面的归纳最适合不过了. Android五大布局: LinearLayout 线性布局 Relativelayout ...
- Android基本布局
android基本布局有三种:LinearLayout,RelativeLayout,FrameLayout. 一.LinearLayout 1,这是一种垂直布局(或者水平布局),可以通过下面这一句来 ...
- Android课程---布局管理器中的线性布局
线性布局实例: <?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:andro ...
- Android开发--布局二
1.Andrid:控件布局(表格布局)TableLayout 有多少个TableRow对象就有多少行, 列数等于最多子控件的TableRow的列数 直接在TableLayout加控件,控件会占据一行 ...
随机推荐
- Tuning SQL via case when statement
原SQL如下:SQL的主要问题是红色部分居然通过标量查询,反复的查找与SQL相同的基表,很显然这个可以用case when来简化. select a.TRAN_ID,a.AMOUNT,a.BALANC ...
- 配置本地yum源
配置本地yum源 一. 远程挂载ISO文件 mount /dev/sr0 /mnt/cdrom (本地挂载mount -t iso9660 -o loop xx.iso /media) 二. 配置 ...
- 微信接口请求万能函数http_request
关键字:http_request http_request post get http request原文: http://www.cnblogs.com/txw1958/p/http_request ...
- 第二篇 Replication:分发服务器的作用
本篇文章是SQL Server Replication系列的第二篇,详细内容请参考原文. 分发服务器是SQL Server复制的核心组件.分发服务器控制并执行数据从一个服务器移动到另一个服务器的进程. ...
- 启用Service Broker
2015-10-20 17:31 整理,未发布数据库邮件配置向导,在选择配置任务页面点击下一步时,弹出"数据库邮件依赖于 Service Broker...".点击是,整个SSMS ...
- selenium 基本了解
Selenium的界面 白色:还未执行 浅青色:动作成功 深青色:判断成功 浅粉红色:判断失败,但不影响测试案例的运行 深粉红色:判断失败,且测试案例无法正常运行 Command 存在的命令 Acti ...
- 教你安装CentOS 6.5如何选择安装包
近来发现越来越多的运维小伙伴们都有最小化安装CentOS 6.5系统的洁癖,因此,找老男孩来咨询,这个“洁癖”好习惯啊,必须支持,,因此发布本文和大家分享下. (1)系统安装类型选择及自定义额外包组 ...
- javascript设计模式学习之十七——程序设计原则与面向接口编程
一.编程设计原则 1)单一职责原则(SRP): 这里的职责是指“引起变化的原因”:单一职责原则体现为:一个对象(方法)只做一件事. 事实上,未必要在任何时候都一成不变地遵守原则,实际开发中,因为种种原 ...
- QString 和 TCHAR 的相互转换
参考资料: http://www.cnblogs.com/fuyanwen/p/3200536.htmlhttp://www.cnblogs.com/wendao/archive/2012/07/27 ...
- Rman备份的保留策略(retention policy)
什么是备份的保留策略(retention policy) 保留策略就是指某份备份是否要保留以及保留多久.可以使用configure retention policy命令来创建一个一致的.自动的备份保留 ...