【Android UI】使用RelativeLayout与TableLayout实现登录界面
来源:互联网 发布:Linux用wine玩英雄联盟 编辑:程序博客网 时间:2024/04/26 11:35
使用RelativeLayout与TableLayout分别实现两种登录界面,学习RelativeLayout布局
中如何对齐与调整组件相对位置,使用TableLayout实现登录界面,学习如何设置列
的长度,与对齐方式等。
RelativeLayout中使用如下属性调整组件相对位置
layout_alignParentLeft :表示组件左对齐布局
layout_alignParentRight:表示组件有对齐布局
layout_below="@+id/edit1":表示组件在edit1组件下面
layout_toRightOf="@+id/edit1":表示组件放在edit1的右边
效果图:
TableLayout实现效果:
RelatvieLayout实现登录的XML文件
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/RelativeLayout01"android:layout_width="fill_parent" android:layout_height="fill_parent"><TextView android:layout_height="wrap_content" android:id="@+id/textView1"android:layout_width="wrap_content" android:text="用户名:"android:layout_marginLeft="5dp"android:textColor="@color/green"android:layout_marginRight="5dp"android:layout_alignParentLeft="true"></TextView><EditText android:layout_height="wrap_content"android:layout_width="fill_parent"android:layout_toRightOf="@+id/textView1" android:id="@+id/editText1"></EditText><TextView android:layout_height="wrap_content" android:id="@+id/textView2"android:layout_width="wrap_content" android:text="密码:"android:layout_marginLeft="5dp"android:textColor="@color/green"android:layout_marginRight="5dp"android:layout_below="@+id/editText1"android:layout_alignParentLeft="true"></TextView><EditText android:layout_height="wrap_content"android:layout_width="fill_parent"android:layout_toRightOf="@+id/textView2" android:id="@+id/editText2"android:layout_below="@+id/editText1"></EditText><Button android:layout_height="wrap_content" android:text="登录" android:layout_width="wrap_content" android:layout_below="@+id/editText2"android:layout_alignParentLeft="true" android:id="@+id/button1"></Button><Button android:layout_height="wrap_content" android:text="注册" android:layout_width="wrap_content" android:layout_below="@+id/editText2"android:layout_toRightOf="@+id/button1" android:id="@+id/button2"></Button></RelativeLayout>TableLayout实现登录的XML文件
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/tableLayout1"android:layout_width="fill_parent" android:layout_height="fill_parent"><TableRow android:id="@+id/TableRow01"><TextView android:layout_height="wrap_content"android:layout_width="wrap_content"android:text="帐号"android:textColor="@color/green"android:layout_marginLeft="5dp"android:layout_marginRight="5dp"></TextView><EditText android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"/></TableRow><TableRow android:id="@+id/TableRow02"><TextView android:layout_height="wrap_content"android:layout_width="wrap_content"android:text="密码"android:textColor="@color/green"android:layout_marginLeft="5dp"android:layout_marginRight="5dp"></TextView><EditText android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"/></TableRow><TableRow android:id="@+id/TableRow03"android:layout_height="wrap_content"android:layout_width="fill_parent"android:gravity="right"><Button android:id="@+id/login_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="登录"android:textColor="@color/green"/><Button android:id="@+id/register_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="注册"android:textColor="@color/green"/></TableRow></TableLayout>
- 【Android UI】使用RelativeLayout与TableLayout实现登录界面
- android开发利用tablelayout布局实现登录界面
- TableLayout实现登录界面
- Android UI界面之TableLayout
- Android中LinearLayout、RelativeLayout、TableLayout、AbsoluteLayout容器的使用
- Android中LinearLayout、RelativeLayout、TableLayout、AbsoluteLayout容器的使用
- android:Layout探索之混合使用RelativeLayout和TableLayout
- RelativeLayout 登录界面
- android UI注册登录界面
- Android-UI:用户登录界面
- 【UI布局】浅谈android五大布局-FrameLayout、LinearLayout、AbsoluteLayout、RelativeLayout、TableLayout】
- Android UI学习 - TableLayout
- Android UI - TableLayout
- Android UI学习 - TableLayout
- Android UI学习 - TableLayout
- Android UI学习 - TableLayout
- Android UI学习 - TableLayout
- Android UI学习 - TableLayout
- AT88SC0104C读写程序
- DriverStudio 和 WDF驱动 通过GUID获取设备句柄的差别
- 比较两个类型为String的字符串
- 加密芯片的功能和基本原理
- Oracle数据库备份与恢复的常用方法
- 【Android UI】使用RelativeLayout与TableLayout实现登录界面
- 汉诺塔--char4
- NGUI 动态改变Label字体
- Galaxy Tab3 10.1如何开启被隐藏的开发者选项?
- [WinForm]动态显示本地目录图片与悬浮窗
- 《编程之美》读书随笔之三:一摞烙饼的排序问题
- 荷兰国旗问题
- SNMPv3认证和加密过程
- Node.js 究竟是什么?