从零開始学android<RelativeLayout相对布局.十六.>
|
No.
|
属性名称
|
相应的规则常量
|
描写叙述
|
|
1
|
android:layout_below
|
RelativeLayout.BELOW
|
摆放在指定组件的下边
|
|
2
|
android:layout_toLeftOf
|
RelativeLayout.LEFT_OF
|
摆放在指定组件的左边
|
|
3
|
android:layout_toRightOf
|
RelativeLayout.RIGHT_OF
|
摆放在指定组件的右边
|
|
4
|
android:layout_alignTop
|
RelativeLayout.ALIGN_TOP
|
以指定组件为參考进行上对齐
|
|
5
|
android:layout_alignBottom
|
RelativeLayout.ALIGN_BOTTOM
|
以指定组件为參考进行下对齐
|
|
6
|
android:layout_alignLeft
|
RelativeLayout.ALIGN_LEFT
|
以指定组件为參考进行左对齐
|
|
7
|
android:layout_alignRight
|
RelativeLayout.ALIGN_RIGHT
|
以指定组件为參考进行右对齐
|
<span style="font-size:18px;"><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:textAlignment="center"
tools:context=".MainActivity" > <EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:ems="10" /> <EditText
android:id="@+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/editText1"
android:layout_below="@+id/editText1"
android:ems="10"
android:inputType="textPassword" > <requestFocus />
</EditText> <TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/editText1"
android:layout_alignParentLeft="true"
android:text="账号" /> <TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/editText2"
android:layout_alignParentLeft="true"
android:text="password"
android:textAlignment="center" /> <Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/editText2"
android:layout_marginLeft="23dp"
android:layout_marginTop="36dp"
android:layout_toRightOf="@+id/textView2"
android:text="登 录" /> <TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/button1"
android:layout_marginLeft="14dp"
android:layout_toRightOf="@+id/button1"
android:autoLink="web"
android:linksClickable="true"
android:text="忘记password"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="10dp" /> </RelativeLayout>
</span>
使用相对布局是眼下基本的布局方式,它比其它方式都方便快捷,能够再可视化界面直接拖拽就可以。
|
1
|
public RelativeLayout.LayoutParams (int w, int h)
|
构造
|
指定RelativeLayout布局的宽度和高度
|
|
2
|
public void addRule (int verb, int anchor)
|
普通
|
添加指定的參数规则
|
|
3
|
public int[] getRules ()
|
普通
|
取得一个组件的所有參数规则
|
从零開始学android<RelativeLayout相对布局.十六.>的更多相关文章
- 从零開始学android<使用嵌套布局实现计算器界面.十七.>
所谓的嵌套布局就是在一个文件里嵌套多个布局文件 <span style="font-size:18px;"> <LinearLayout android:layo ...
- 从零開始学android<ScrollView滚动视图.十八.>
因为手机屏幕的高度有限.所以假设面对组件要显示多组信息的时候,ScrollView视图(滚动视图)能够有效的安排这些组件,浏览时能够自己主动的进行滚屏的操作. android.widget.Scrol ...
- 第13章、布局Layouts之RelativeLayout相对布局(从零開始学Android)
RelativeLayout相对布局 RelativeLayout是一种相对布局,控件的位置是依照相对位置来计算的,后一个控件在什么位置依赖于前一个控件的基本位置,是布局最经常使用,也是最灵活的一种布 ...
- 从零開始学android<数据存储(1)SharedPreferences属性文件.三十五.>
在android中有五种保存数据的方法.各自是: Shared Preferences Store private primitive data in key-value pairs. 相应属性的键值 ...
- 从零開始学android<SeekBar滑动组件.二十二.>
拖动条能够由用户自己进行手工的调节,比如:当用户须要调整播放器音量或者是电影的播放进度时都会使用到拖动条,SeekBar类的定义结构例如以下所看到的: java.lang.Object ↳ an ...
- 从零開始学android<mediaplayer自带播放器(视频播放).四十九.>
MediaPlayer除了能够对音频播放之外,也能够对视频进行播放,可是假设要播放视频仅仅依靠MediaPlayer还是不够的.还须要编写一个能够用于视频显示的空间,而这块显示空间要求能够高速的进行G ...
- 从零開始学android<TabHost标签组件.二十九.>
TabHost主要特点是能够在一个窗体中显示多组标签栏的内容,在Android系统之中每一个标签栏就称为一个Tab.而包括这多个标签栏的容器就将其称为TabHost.TabHost类的继承结构例如以下 ...
- 从零開始学android<ImageSwitcher图片切换组件.二十六.>
ImageSwitcher组件的主要功能是完毕图片的切换显示,比如用户在进行图片浏览的时候.能够通过button点击一张张的切换显示的图片,并且使用ImageSwitcher组件在每次切换的时候也能够 ...
- 从零開始学android<AnalogClock与DigitalClock时钟组件.三十一.>
这两个组件比較交单,大家看下会使用即可了 XML文件配置 <span style="font-size:18px;"><RelativeLayout xmlns: ...
随机推荐
- C 文件直接包含
C 文件直接包含 有一部分代码很大,在很多函数中重复,可以直接写在另外的一个文件中,引用时直接包含.co.cpp两个函数都 包含c1.cxx. 点击(此处)折叠或打开 ////// co.cpp #i ...
- VirtualBox,Kernel driver not installed (rc=-1908)
http://hi.baidu.com/spt_form/item/316d6207b47b8ee03499020a VirtualBox,Kernel driver not installed (r ...
- 在VC++中启用内存泄露检测
检测内存泄漏的主要工具是调试器和 CRT 调试堆函数.若要启用调试堆函数,请在程序中包括以下语句: #define CRTDBG_MAP_ALLOC#include <stdlib.h># ...
- All consistent reads within the same transaction read the snapshot established by the first read.
Session 1: Session 2: mysql> show variables like '%tx_isolation%'; +---------------+------------- ...
- VMware vSphere 服务器虚拟化之二十八 桌面虚拟化之安装View传输服务器
VMware vSphere 服务器虚拟化之二十八 桌面虚拟化之安装View传输服务器 View 传输服务器用于管理和简化数据中心与在最终用户本地系统上检出使用的 View 桌面之间的数据传输.必须安 ...
- jQuery中常用的函数方法
jQuery中常用的函数方法总结 Ajax处理 load(url,[data],[callback]) url (String) : 待装入 HTML 网页网址. data (Map) : (可选) ...
- Windows 8.1下 MySQL绿色版安装配置与使用
原文:Windows 8.1下 MySQL绿色版安装配置与使用 Mysql-5.6.17-winx64操作步骤: 一.安装MySQL数据库 1.下载. 下载地址:http://downloads.my ...
- Hadoop Hive与Hbase关系 整合
用hbase做数据库,但因为hbase没有类sql查询方式,所以操作和计算数据很不方便,于是整合hive,让hive支撑在hbase数据库层面 的 hql查询.hive也即 做数据仓库 1. 基于Ha ...
- WindowsclientC/C++编程规范“建议”——前言
前言 工作中接触了非常多编程规范.当中最有意思的是,公司近期公布了一版C/C++编程规范,然后我看到该规范的最后一段时,有这么一句:"该规范不适用于Windows平台开发".看来这 ...
- 【iOS开发】 常遇到的Crash和Bug处理
一,Unknown type name .... 如果是报这个错误,多半是你的对象类型没有被识别,检查是不是没有引用对应的库或者头文件在你的文件头部分,还有可能是循环引用导致的,循环引用的解决方法就是 ...