您的位置:首页 > 移动开发 > Android开发

【android】:TableLayout的用法

2016-05-26 23:25 429 查看

前言

正常的xml的用法,然后就是一个标签代表着一行

一行里面可以写多个控件,其中

android:stretchColumns = “n” 这个属性代表着第n+1列会匹配剩余空间

一个实例为证:

xml文件为:

<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="Account:"/>
<EditText
android:id="@+id/account"
android:layout_height="wrap_content"
android:hint = "Input your account"
/>
</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:id="@+id/login"
android:layout_height="wrap_content"
android:layout_span ="2"
android:text = "Login"/>
</TableRow>
</TableLayout>


实例图:(明天传)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: