我有这个代码:
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/cashItemsList"
android:cacheColorHint="#00000000"
android:divider="@drawable/list_divider"></ListView>
Run Code Online (Sandbox Code Playgroud)
在哪里@drawable/list_divider:
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:width="1dp"
android:color="#8F8F8F"
android:dashWidth="1dp"
android:dashGap="1dp" />
</shape>
Run Code Online (Sandbox Code Playgroud)
但我看不到任何分隔线.
我需要更改listview中的分隔符颜色.我用来完成此任务的代码如下所示:
<ListView
android:id="@+id/restaurant_list_widget"
android:layout_width="1px"
android:layout_height="1px"
android:layout_weight="1" android:background="@drawable/list"
android:divider="#FFFFFF"
android:dividerHeight="4px">
</ListView>
Run Code Online (Sandbox Code Playgroud)
我仍然得到一个黑色的1px宽分频器.我究竟做错了什么?
更新:ListItem
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
android:background="@color/list_background">
<TextView
android:id="@+id/restaurant_list_item_name"
android:layout_marginBottom="4dp"
android:textStyle="bold"
android:textSize="15dp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#fff"
android:text="Restaurant Name Goes Here"></TextView>
<TextView
android:id="@+id/restaurant_list_item_detail"
android:textSize="10dp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"></TextView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 默认情况下,android listview中每个项目的底部都有一条水平线.我的问题是:如何让线不显示
想象一下基本的ListView,如下所示:
Item1
---------
Item2
---------
Item3
---------
Item4
Run Code Online (Sandbox Code Playgroud)
如何更改------在ListView中划分每个项目的行的颜色或宽度?