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