簡體   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