我正在学习android,正在努力理解这个特殊的布局属性,阅读谷歌开发文档:
android:layout_column
该子元素所在列的索引。必须是整数值,如"100“。这也可以是对包含此类型的值的资源(格式为"@package: type :name")或主题属性(格式为"?package:name")的引用。这对应于全局属性资源符号layout_column。
谁能解释一下这是如何映射到html的等价物的(因为表行似乎大量地借用了它们)?
是它需要的列数吗,例如colspan?
发布于 2010-12-05 07:21:05
它的意思是“这个孩子所在的列的索引”。唯一棘手的部分是列从0开始。
例如:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1">
<TableRow>
<TextView
android:text="URL:" />
<EditText android:id="@+id/entry"
android:layout_span="3"/>
</TableRow>
<TableRow>
<Button android:id="@+id/cancel"
android:layout_column="2"
android:text="Cancel" />
<Button android:id="@+id/ok"
android:text="OK" />
</TableRow>
</TableLayout>
上面布局中的两行都有四列。第一个有四列,因为它在第0列有一个TextView
,EditText
跨越第1、2和3列。第二个有四列,因为它跳过第0列和第1列,将两个Button
部件放在第2列和第3列,这要归功于第一个Button
中的android:layout_column="2"
属性。
https://stackoverflow.com/questions/4356372
复制相似问题