从零开始学android<RelativeLayout相对布局.十六.>
来源:互联网 发布:微盟软件退款 编辑:程序博客网 时间:2024/09/21 09:02
相对布局管理器指的是参考某一其他控件进行摆放,可以通过控制,将组件摆放在一个指定参考组件的上、下、左、右等位置,这些可以直接通过各个组件提供的属性完成。
下面介绍一下各个方法的基本使用
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="密码" 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="忘记密码" 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 ()
普通
下节预报:使用嵌套布局实现计算器界面
0 0
- 从零开始学android<RelativeLayout相对布局.十六.>
- 第13章、布局Layouts之RelativeLayout相对布局(从零开始学Android)
- 第13章、布局Layouts之RelativeLayout相对布局(从零开始学Android)
- 第13章、布局Layouts之RelativeLayout相对布局(从零开始学Android)
- 第13章、布局Layouts之RelativeLayout相对布局(从零开始学Android)
- 第13章、布局Layouts之RelativeLayout相对布局(从零开始学Android)
- Android 相对布局:RelativeLayout
- android 相对布局RelativeLayout
- android 相对布局 RelativeLayout
- Android相对布局(RelativeLayout)
- Android--RelativeLayout相对布局
- Android RelativeLayout相对布局
- Android相对布局RelativeLayout
- Android 相对布局 RelativeLayout
- Android RelativeLayout 相对布局
- Android相对布局(RelativeLayout)
- 13、从头学Android之RelativeLayout相对布局
- 13、从头学Android之RelativeLayout相对布局
- 如何删除myeclipse下的SVN用户名和密码
- java.lang.IllegalArgumentException: Malformed \uxxxx encoding异常解析
- Android App应用之提交到各大市场渠道
- 验证码识别实践2:自己动手C#实现,对CSDN资源上传验证码识别率100%,久游网登陆90%
- 2-SAT问题
- 从零开始学android<RelativeLayout相对布局.十六.>
- 谈《百度搜索引擎网页质量白皮书》
- C# 类的访问修饰符
- 内存管理高级
- Yii RBAC中的大致说明
- LINK - WinRT - WebView
- App应用之启动界面SplashActivity
- hdu 1695 GCD(欧拉函数+容斥原理)
- 监控redis的内存使用情况