TableLayout方向问题

时间:2011-07-26 12:51:52

标签: android tablelayout

<ScrollView android:layout_width="fill_parent"
    android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android">
    <HorizontalScrollView android:layout_width="fill_parent"
        android:layout_height="wrap_content">

        <TableLayout android:id="@+id/test_table"
            android:layout_width="match_parent" android:layout_height="fill_parent"
            android:orientation="horizontal">

            <TableRow android:id="@+id/column_01" android:layout_height="wrap_content"
                android:orientation="vertical">
                <TextView android:id="@+id/column_01_header"
                    android:layout_height="match_parent" android:layout_width="wrap_content"
                    android:text="Column 01 Header" />
            </TableRow>

            <TableRow android:id="@+id/column_02" android:layout_height="wrap_content"
                android:orientation="vertical">
                <TextView android:id="@+id/column_02_header"
                    android:layout_height="match_parent" android:layout_width="wrap_content"
                    android:text="Column 02 Header" />
            </TableRow>

        </TableLayout>
    </HorizontalScrollView>
</ScrollView>

输出是(垂直)

Column Header 01
Column Header 02

但我希望输出像(水平)

 Column Header 01 Column Header 02

2 个答案:

答案 0 :(得分:0)

使用TableLayout的理由是什么?你需要在同一个TabelRow中同时使用TextView来获得你想要的东西。不同的行将一个在另一个下面对齐。

答案 1 :(得分:0)

你将列标题01放在一行,列标题02放在另一行。显然它是垂直的。连续两个放