2013-07-23 47 views
1

我的代碼如下所示。我的觀點顯示如此之多的厚度;我希望減少這一點。android如何減少視圖厚度

http://imgur.com/KaIpJee

我想這個圖像中添加一個分隔符,如:

http://imgur.com/2ZtcoIB

我如何做一個小的垂直看法?

<LinearLayout 
    android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="#C0C0C0" 
android:layout_weight="2" 
    android:orientation="vertical" > 

    <TableLayout 
     android:id="@+id/table" 
     android:layout_width="fill_parent" 




android:layout_height="fill_parent" 
android:stretchColumns="*" > 

    <TableRow 
    android:layout_width="match_parent" 
    android:layout_marginTop="5dp" 
    android:layout_height="match_parent" > 

    <TextView 
     android:gravity="left" 
      android:layout_marginTop="8dp" 
     android:text="Farm a School" /> 
    <View 
android:layout_width="0.1dip" 
android:layout_height="fill_parent" 
android:background="#000000" 
/> 


    <TextView 
     android:gravity="center" 
      android:layout_marginTop="8dp" 
     android:text="Take a survey" /> 
    <View 
android:layout_width="0.1dip" 
android:layout_height="fill_parent" 
android:background="#000000" 
    /> 
    <TextView 
     android:gravity="center" 
     android:layout_marginTop="8dp" 
     android:text="Share this App" /> 

</TableRow> 

</TableLayout> 

    </LinearLayout> 
+1

在你的黑色分隔視圖中,首先使視圖寬度1px,而不是0.1dp,也玩android:maxWidth/android:minWidth – talkol

回答

0

你可能想擺脫stretchcolumns的*將意味着,每列將被拉伸以填充屏幕。導致欄忽略你的寬度設置。

如果您仍然希望文本的寬度共享屏幕空間。使用

android:stretchColumns="0,2,4" 

其中0,2,4是包含文本的每個列索引。

+0

我如何設置?幫助我如何讓小垂直視圖? – user2589245

+0

看到編輯,你可以用上面的替換你的stretchcolumns,它應該工作。 – Nicholas