你直接设置item于上端和下端的距离就行了

解决方案 »

  1.   

    我的实现方式:
    1、隐藏默认分割线
    mListView.setDividerHeight(0);
    mListView.setCacheColorHint(0);
    2、重写适配器的getView,自定义Item的布局
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" 
        android:background="@color/app_background">    <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dip"
            android:layout_weight="1"
            android:orientation="horizontal"
            android:gravity="center_vertical"
            android:background="@drawable/list_item_bg">        <TextView
                android:layout_width="0dip"
                android:layout_height="match_parent"
                android:layout_weight="1"/>        <TextView
                android:layout_width="0dip"
                android:layout_height="wrap_content"
                android:layout_weight="1" />        <ImageView
                android:layout_width="25dip"
                android:layout_height="25dip"/>
        </LinearLayout>
        
            <View android:layout_width="match_parent" 
                android:layout_height="1dip" 
                android:layout_marginLeft="15dip"
                android:layout_marginRight="15dip"
                android:background="@color/line_gray"/>
            
            <View android:layout_width="match_parent" 
                android:layout_height="1dip" 
                android:layout_marginLeft="15dip"
                android:layout_marginRight="15dip"
                android:background="@color/write"/></LinearLayout>view就是分割线,设置android:layout_marginLeft="15dip",android:layout_marginRight="15dip"就能够实现了。整体效果如下:
      

  2.   

    下面的两个View是干啥的?
    那就是分割线,一条黑的一条灰的,有凹凸效果。效果上图了呵。