每个其他列表分隔符都比指定的厚

时间:2015-07-27 14:28:45

标签: android android-layout android-listview

似乎无法解决我遇到的问题。从图像中可以看出,中间的列表分隔符比其他两个更粗。有谁知道我怎么解决这个问题?

activity_main.xml中

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <ListView
        android:id="@+id/list"
        android:background="@color/colorWhite"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:divider="@color/dividerColor"
        android:dividerHeight="1dp"/>
</RelativeLayout>

list_row.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="16dp" >

    <!-- Id -->
    <TextView
        android:id="@+id/id"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="16dp"
        android:layout_marginEnd="16dp"/>

    <!-- Name -->
    <TextView
        android:id="@+id/name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@+id/id"
        android:layout_toEndOf="@+id/id"/>

    <!-- Location -->
    <TextView
        android:id="@+id/location"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/id"
        android:layout_marginTop="16dp"/>
</RelativeLayout>

List Divider

1 个答案:

答案 0 :(得分:0)

也许您的listview的列表项之一为空,导致两个分隔符堆叠。