8
所以我试图使用XML android:divider
属性在LinearLayout中的视图之间放置一个分隔线。当我使用垂直LinearLayout时,没有分隔线显示。当我使用水平LinearLayout时,分频器显示并正常工作。下面是我使用的分隔符的绘制(drawable/one.xml
):垂直LinearLayout的分频器?
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<size android:width="1dip" />
<solid android:color="#FFFFFF" />
</shape>
这里是我的LinearLayout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@drawable/one"
android:dividerPadding="10dp"
android:showDividers="middle">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="test1"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="test2"
/>
</LinearLayout>
是没可能时使用的分隔属性与垂直线性布局或我错过了什么吗?
或者说,你需要有两个可绘制一个设置为1dip宽度,其中一个的高度设置为1dip – scrayne
你救了我免于自杀;) – marioosh
该死的,这应该是显而易见的。谢谢你。 – LiveMynd