【Android UI】使用RelativeLayout与TableLayout实现登录界面
2013-10-30 22:34
816 查看
使用RelativeLayout与TableLayout分别实现两种登录界面,学习RelativeLayout布局
中如何对齐与调整组件相对位置,使用TableLayout实现登录界面,学习如何设置列
的长度,与对齐方式等。
RelativeLayout中使用如下属性调整组件相对位置
layout_alignParentLeft :表示组件左对齐布局
layout_alignParentRight:表示组件有对齐布局
layout_below="@+id/edit1":表示组件在edit1组件下面
layout_toRightOf="@+id/edit1":表示组件放在edit1的右边
效果图:
TableLayout实现效果:
RelatvieLayout实现登录的XML文件
TableLayout实现登录的XML文件
中如何对齐与调整组件相对位置,使用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 UI】使用RelativeLayout与TableLayout实现登录界面
- 【Android UI】使用RelativeLayout与TableLayout实现登录界面
- android开发利用tablelayout布局实现登录界面
- Android UI开发第四十三篇——使用Property Animation实现墨迹天气3.0引导界面及动画实现
- 在Android的UI开发中,有时为了界面美观而需要使用虚线。在这里我自己实现一个画虚线的控件。
- AndroidUI之登录界面的实现分析
- TableLayout实现登录界面
- android 中使用TableLayout实现表单布局效果示例
- Android手机UI设计---”知乎“界面外观模仿篇(一)---使用Fragment实现底部导航以及嵌套
- 【Android界面实现】使用ActionBar和DrawerLayout纯原生控件,实现侧滑栏和滑动Tab界面
- Android UI开发第四十三篇——使用Property Animation实现墨迹天气3.0引导界面及动画实现
- 03_android入门_采用RelativeLayout实现登陆界面效果
- [Android]使用二维表格实现 TableLayout 跨行(转)
- android RelativeLayout属性和使用, 实现上面view叠加在下面view之上的效果2
- android RelativeLayout属性和使用, 实现上面view叠加在下面view之上的效果
- Android基础学习总结(六)——TextInputLayout+EditText 轻松实现登录界面
- Android Material Design控件学习(三)——使用TextInputLayout实现酷市场登录效果
- Android开发丶使用DialogFragment实现炫酷的登录界面并实现DialogFragment与宿主Activity的通信
- 快速开发android应用2-使用TextInputLayout实现用户登录及验证