繁体   English   中英

ListView分隔符未划分项目

[英]ListView divider is not dividng items

我有一个列表视图:

<ListView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@android:id/list"
    android:layout_weight="1"
    android:divider="@null"
    android:dividerHeight="8dp"/>

我还有一个drawable为listview项绘制圆角:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
    <solid android:color="@color/listViewItemBackground"/>
    <corners android:radius="5dp" />
    <padding android:left="3dp" android:top="3dp" android:right="3dp" android:bottom="3dp" />
</shape>

通过以上设置,这些项目彼此接触。

我想念什么?

您已经设置了android:divider="@null"因此显然看不到分隔线。

查看此人如何设置其ListView分隔符,以作为示例您应该做什么。

尝试如下...

android:divider="@color/redBackground"

颜色值位于colors.xml中:

<color name="redBackground">#C60202</color>

请参阅下面的链接以获取更多详细信息...

http://developer.android.com/reference/android/widget/ListView.html#attr_android:divider

android:divider

可绘制的或可在列表项之间绘制的颜色。

可以以"@[+][package:]type:name"的形式引用另一个资源,或以"?[package:][type:]name"的形式引用主题属性。

可以是彩色值,在形式"#rgb""#argb""#rrggbb" ,或"#aarrggbb"

这对应于全局属性资源符号分隔符。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM