展会信息港展会大全

Android ApiDemos示例解析(165):Views->Layouts->TableLayout->10. Simple Form
来源:互联网   发布日期:2015-10-13 15:24:11   浏览:2244次  

导读:本例使用LabelLayout构造了一个简单输入表单:<TableLayout xmlns:android=”http://schemas.android.com/apk/res/andro...

本例使用LabelLayout构造了一个简单输入表单:

<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:text=”@string/table_layout_10_user”

android:textStyle=”bold”

android:gravity=”right”

android:padding=”3dip” />

<EditText android:id=”@+id/username”

android:text=”@string/table_layout_10_username_text”

android:padding=”3dip”

android:scrollHorizontally=”true” />

</TableRow>

<TableRow>

<TextView

android:text=”@string/table_layout_10_password”

android:textStyle=”bold”

android:gravity=”right”

android:padding=”3dip” />

<EditText android:id=”@+id/password”

android:text=”@string/table_layout_10_password_text”

android:password=”true”

android:padding=”3dip”

android:scrollHorizontally=”true” />

</TableRow>

<TableRow

android:gravity=”right”>

<Button android:id=”@+id/cancel”

android:text=”@string/table_layout_10_cancel” />

<Button android:id=”@+id/login”

android:text=”@string/table_layout_10_login” />

</TableRow>

</TableLayout>

android:stretchColumns=”1″ 表示第二列将占据表格剩余空间,注意EditText 的android:scrollHorizontally 属性,当EditText输入多行时,该行高度也会跟着变化:

赞助本站

人工智能实验室

相关热词: android开发 教程

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港