2013-07-23 48 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