TableRow的用法很简单,官方的解释是TableRow应作为TableLayout的子视图,否则TableRow将相当于一个水平方向布局的LinearLayout。TableLayout和TableRow的结合使用就像一个HTML表格的结构,TableLayout元素就相当于HTML中的
下面的布局文件是展示一个输入用户名和密码的注册界面。
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:stretchColumns="1">
android:layout_height="wrap_content">
android:layout_width="wrap_content" android:layout_height="wrap_content">
android:layout_height="wrap_content">
android:layout_height="wrap_content">
android:layout_width="wrap_content" android:layout_height="wrap_content">
android:layout_height="wrap_content" android:password="true">
android:layout_height="wrap_content">
android:layout_width="wrap_content" android:layout_height="wrap_content" />
android:layout_width="wrap_content" android:layout_height="wrap_content" />
运行结果如图显示: