2013-02-06 21 views
0

我有XML這是我從服務器獲取和我有HTML表是這樣的:HTML表格到Android TableLayout

<table> 
    <tr> 
     <td colspan="4">$kolumn1$</td> 
    </tr> 
    <tr> 
     <td colspan="2">$kolumn2$</td> 
     <td>$kolumn3$</td> 
     <td>$kolumn4$</td> 
    </tr> 
    <tr> 
     <td>$kolumn5$</td> 
     <td colspan="3">$kolumn1$</td> 
    </tr> 
</table> 

,現在,我要創建的Android TableLayout是這樣的:

<TableRow 
    android:layout_width="fill_parent" 
    android:layout_height="match_parent" > 

    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="match_parent" 
     android:layout_span="4" /> 
</TableRow> 

<TableRow 
    android:layout_width="fill_parent" 
    android:layout_height="match_parent" > 

    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="match_parent" 
     android:layout_span="2" /> 

    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="match_parent" /> 

    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="match_parent" /> 
</TableRow> 

<TableRow 
    android:layout_width="fill_parent" 
    android:layout_height="match_parent" > 

    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="match_parent" /> 

    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="match_parent" 
     android:layout_span="3" /> 
</TableRow> 

從HTML代碼創建TableLayout的最佳方法是什麼?

回答

0

試試這個:

I have to like create Relative layout inside the TableRow 
And put the components to Relative layout 
It's worked me. I hope this will be worked for you also.. 
+0

你是認真的? – Anuj

+0

是的,這將適用於佈局。 –