android如何减少视图厚度
我的代码如下所示。我的视图显示得很厚;我希望减少这一点 我希望添加一个分隔符,如下图所示: 如何制作一个小的垂直视图android如何减少视图厚度,android,Android,我的代码如下所示。我的视图显示得很厚;我希望减少这一点 我希望添加一个分隔符,如下图所示: 如何制作一个小的垂直视图 <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#C0C0C0" android:layout_weight="2" android:orientation="vertical" >
<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>
您可能想摆脱
stretchcolumns
的*将意味着每一列都将被拉伸以填满屏幕。导致该条忽略设置的宽度
如果您仍然希望文本的宽度共享屏幕空间。使用
android:stretchColumns="0,2,4"
其中0,2,4是包含文本的每个列索引。我如何设置?帮助我如何创建小垂直视图?请参见编辑,您可以用上面的一个替换stretchcolumns,它应该可以工作。在黑色分隔符视图中,首先将视图宽度设为1px,而不是0.1dp,并使用android:maxWidth/android:minWidth播放