ListView divider is not visible

僤鯓⒐⒋嵵緔 提交于 2019-12-13 04:29:17

问题


I want to have a white line which will divide m y listview. I was trying different ways but still I can't get it. Code:

 <?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="match_parent"
     android:background="@color/dark_background"
     android:orientation="vertical" >

     <ListView
         android:id="@+id/lvFragFeedList"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:background="@drawable/alerts_list_item_selector"
         android:choiceMode="singleChoice" 
         android:divider="@color/archive_list_view_divider"
         android:dividerHeight="4dip">
     </ListView>

 </LinearLayout>

回答1:


 <ListView
     android:id="@+id/lvFragFeedList"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:background="@drawable/alerts_list_item_selector"
     android:choiceMode="singleChoice" 
     android:divider="@drawable/list_divider"
     android:dividerHeight="4dip">
 </ListView>

list_divider:

<shape
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:shape="line">
<stroke
  android:width="1px"
  android:color="#FFFFFF"
  android:dashWidth="1px"
  android:dashGap="1px" />
</shape>


来源:https://stackoverflow.com/questions/22310963/listview-divider-is-not-visible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!