TableLayout Orientation Problem
<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_con开发者_JAVA技巧tent">
<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>
The output is (vertical)
Column Header 01
Column Header 02
But I want output like (horizontal)
Column Header 01 Column Header 02
What is the rationale for using TableLayout? You need to have both TextView in same TabelRow to get what you desire. Different rows would be aligned one below the other.
You are putting Column Header 01 in a row and Column Header 02 in another row.So obviously it is vertical.Put two in a row
精彩评论