繁体   English   中英

Android ListView分隔线每隔第二行就不同

[英]Android ListView divider different for every second row

所以我有一个divider.xml

<?xml version="1.0" encoding="utf-8" ?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
  <solid android:color="@color/red"/>
</shape>

我的视图如下所示:

 <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <Mvx.MvxListView
            android:id="@+id/suppliersListView"
            android:divider="@drawable/divider"
            android:scrollbars="vertical"
            android:choiceMode="singleChoice"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="left|start" 
            local:MvxItemTemplate="@layout/item_supplier"
            local:MvxBind="ItemsSource ReceptionSuppliersList; ItemClick ReceptionBasicInformationSelectCommand"/>
    </LinearLayout>

在@ layout / item_supplier中,我没有红色的样式属性。

在此处输入图片说明

因此,当我运行视图时,这样显示,第二,第四等行比第一和第二元素之间的行更加突出。

有什么想法吗?

这是仿真器的典型行为。 在绘制线条或点之类的微小物体时,一些像素会丢失。

在真实设备上启动您的应用,它应该可以正常运行。

Listview添加以下属性,并在android:divider使用您喜欢的颜色,然后在android:cacheColorHint放入透明颜色,如下所示:

android:divider="#00000000"
android:cacheColorHint="#00000000"
android:fadingEdge="none"

暂无
暂无

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

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