对于android内容视图,我有一个垂直的linearlayout,其中有一些textviews,其中有一些行用于划分和分隔垂直元素,这很好用,xml如下.
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="@string/A" />
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="@string/B" />
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="@string/C" />
android:background="#ffffff"
android:layout_width = "fill_parent"
android:layout_height="1dip"/>
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/D" />
android:background="#ffffff"
android:layout_width = "fill_parent"
android:layout_height="1dip" />
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/E" />
现在,我想在带有字符串A / B / C的嵌套文本视图中的水平放置的文本视图之间添加垂直分隔线.当我尝试通过添加硬编码宽度View来做到这一点时,该线跨越了父线性布局的整个高度.
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="@string/A" />
android:background="#ffffff"
android:layout_width = "1dip"
android:layout_height="fill_parent" />
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="@string/B" />
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="@string/C" />
android:background="#ffffff"
android:layout_width = "fill_parent"
android:layout_height="1dip"/>
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/D" />
android:background="#ffffff"
android:layout_width = "fill_parent"
android:layout_height="1dip" />
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/E" />
对于此垂直分隔符视图,我尝试使用android:layout_height =“ wrap_content” />而是显示了相同的结果.
有没有办法在这里使用垂直分隔符,通过引入垂直线分隔文本视图来保留高度?还是必须选择其他布局?