TableLayout 佈局介紹
2016-05-23 19:13
323 查看
TableLayout 允許我們使用表格的方式來排列控件,
以下為一個簡單的登錄界面,
通過TableRow 定義行,每加入一個TableRow即新增一行,在TableRow中每新增一個控件,即新增一列。
通過android:stretchColumns 設定第N+1行進行拉伸,以達到自動適應屏幕的作用。
通過android:inputType 指定密碼文本框為password。
通過android:layout_span 指定login按鈕佔據兩列。
以下為一個簡單的登錄界面,
通過TableRow 定義行,每加入一個TableRow即新增一行,在TableRow中每新增一個控件,即新增一列。
通過android:stretchColumns 設定第N+1行進行拉伸,以達到自動適應屏幕的作用。
通過android:inputType 指定密碼文本框為password。
通過android:layout_span 指定login按鈕佔據兩列。
<?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:stretchColumns="1"> <TableRow> <TextView android:layout_height="wrap_content" android:text="Accout:"/> <EditText android:id="@+id/accout" android:layout_height="wrap_content" android:hint="input your accout"/> </TableRow> <TableRow > <TextView android:layout_height="wrap_content" android:text="Password"/> <EditText android:id="@+id/password" android:layout_height="wrap_content" android:inputType="textPassword"/> </TableRow> <TableRow > <Button android:layout_height="wrap_content" android:id="@+id/login" android:layout_span = '2' android:text="Login"/> </TableRow> <TableRow > <Button android:layout_height="wrap_content" android:id="@+id/exit" android:layout_span = '2' android:text="exit"/> </TableRow> </TableLayout>
相关文章推荐
- 学习SpringMVC(十五)之CRUD操作
- C++作业6
- 编译Linux内核
- Java虚拟机结构分析
- Java虚拟机结构分析
- 相同表结构mysql大表 关联小表可能数据被覆盖
- 桶排序,计数排序算法
- Vim分屏命令
- 字符数组,字符指针,字符串常量
- navicat的简单应用
- Android线程总结
- C++ 标准函数库 —— 文件的输入输出 (Input/Output with files)
- C++ 高级篇(五)—— 预处理指令
- System File Association(转)
- 软件生命周期
- 猴子吃桃问题(三种方法解决)
- 总结
- fopen(),fclose()文件打开关闭函数
- C++ 停止并禁用服务
- Android一种字幕效果的实现