我在android中有应用程序。接口依赖于tablelayout
,其中每一行的内容与另一行不同。我想在某些行中显示5列......怎么会这样?
您可以在每行中包含可变数量的列,这是一个示例:
<TableLayout
android:layout_width="wrap_content"
android:stretchColumns="*"
android:layout_height="wrap_content">
<!-- First row has 5 columns -->
<TableRow>
<TextView
android:layout_column="1"
android:text="Column 1" />
<TextView
android:layout_column="2"
android:text="Column 2" />
<TextView
android:layout_column="3"
android:text="Column 3"/>
<TextView
android:layout_column="4"
android:text="Column 4"/>
<TextView
android:layout_column="5"
android:text="Column 5" />
</TableRow>
<!-- Second row has 3 columns -->
<TableRow>
<TextView
android:layout_column="1"
android:text="Column 1" />
<TextView
android:layout_column="2"
android:text="Column 2" />
<TextView
android:layout_column="3"
android:text="Column 3"/>
</TableRow>
</TableLayout>