2012-08-02 103 views
-2

如何獲取高於我的TableLayout的「大文本」TextView。 (紅色箭頭)桌面佈局的文本視圖

另外,如何關閉我的TableLayout中的行之間的差距。 (布朗箭頭)

Here is a link to the example image.

+0

請發佈您的xml這個佈局,這樣我們可以更好地協助您。 – prolink007 2012-08-02 16:12:20

+0

剛剛編輯我的答案與更多的細節,請嘗試我發佈。它應該解決你的問題。 – prolink007 2012-08-02 16:24:46

+0

對於遲到的回覆感到抱歉,我總是忘記接受。 – psyko666 2013-01-06 10:37:02

回答

0

要解決該行填充問題:

您需要調整每個TableRow填充,請看看下面的XML的TableRow標籤。有提供不同類型的填充。只要看看所提供的,並決定什麼是最適合你的情況。

爲解決TextView「LargeText」的問題:

使用LinearLayout並把TableLayout以上的TextViewvertical方向上LinearLayout,請查看下面的佈局XML。

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <TextView 
     style="@android:style/TextAppearance.Large" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="LargeText" /> 

    <TableLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 

     <TableRow> 

      <TextView 
       android:padding="0dp" 
       android:text="row1_a" /> 
     </TableRow> 

     <TableRow> 

      <TextView 
       android:padding="0dp" 
       android:text="row2_a" /> 
     </TableRow> 
    </TableLayout> 

</LinearLayout> 
+0

感謝抱歉,如果它遲到了,我總是忘記檢查一下stackoverflow並接受,我解決了我的問題,當我回來時它幾乎與你的一樣,再次感謝你。 – psyko666 2013-01-06 10:50:27

1

你有兩個選擇。你可以把它們放在RelativeLayout或者LinearLayout中。如果你把它們放在一個RelativeLayout中,你只需要給文本android:layout_above =「@ id/tablelayout」。如果您想使用LinearLayout,請將方向設置爲垂直並將它們放在那裏。

對於差距,你可能有一些填充的地方。沒有看到代碼就很難說。