2

我有一个自定义 ListView,我想在我的单元格之间显示薄渐变分隔线。这是我的 ListView 的 XML

<ListView
    android:id="@+id/fil"
    android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:divider="@drawable/list_divider"
    android:dividerHeight="1dp"
    android:clickable="true">
</ListView>

在我的 list_divider.xml 中,我定义了一个渐变,如下所示:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

<item>
    <shape android:shape="rectangle">
        <gradient
            android:angle="0"
            android:centerColor="#999999"
            android:endColor="#00000000"
            android:startColor="#00000000" />
    </shape>
</item>

通常,这会显示一个渐变分隔线,但它不起作用。显然,问题出在我的带有 RelativeLayout root 的行布局中:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:background="#ffffff"
    android:padding="5dip" >

当我没有背景时,它正在工作。但是,例如,当我想添加白色背景时,它会显示一个完整的黑色分隔线。这里有什么问题?

谢谢

4

0 回答 0