2011-07-26 41 views
0
<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> 

輸出是(豎)TableLayout定位問題

Column Header 01 
Column Header 02 

但是我要像(水平)

Column Header 01 Column Header 02 
+0

添加第二的TextView(column_02_header)。 –

回答

0

什麼是使用TableLayout理輸出?您需要在同一個TabelRow中使用兩個TextView才能獲得所需的內容。不同的行將一個在另一個之下對齊。

+0

在TableLayout級別符合我的屬性orientation =「horizo​​ntal」應該以水平方式放置botTableRows。不是嗎? – dira

+0

不,這是不正確的TableLayout沒有該屬性,它從它的父LinearLayout借用它。 – PravinCG

0

你把列標頭01的行和列標頭02在另一個row.So顯然是vertical.Put兩個在同一個錶行的行

+0

在TableLayout級別符合我的屬性orientation =「horizo​​ntal」應該以水平方式放置botTableRows。不是嗎? – dira

+0

身高/體重屬性有什麼關係嗎? – dira

+0

你的第一個評論,NO?行意味着行。如果你把一個行中的視圖將採取不同的列。對於第二個,你可以修改高度,重量,但是這是不同的,不會使兩列是兩行 – Rasel