Android 如何在滑动时更改Listview行的颜色,并使其保持不变,直到选择其他行为止?

Android 如何在滑动时更改Listview行的颜色,并使其保持不变,直到选择其他行为止?,android,listview,colors,selector,swipe,Android,Listview,Colors,Selector,Swipe,我使用了SwipeListView来显示一些内容。我希望我的Listview的颜色在触摸、滑动和选择其他行时变为黑色。我该怎么做?我尝试了以下方法,但没有效果 main.xml <com.fortysevendeg.swipelistview.SwipeListView android:id="@+id/example_swipe_lv_list" android:layout_width="fill_parent" android

我使用了
SwipeListView
来显示一些内容。我希望我的Listview的颜色在触摸、滑动和选择其他行时变为黑色。我该怎么做?我尝试了以下方法,但没有效果

 main.xml


 <com.fortysevendeg.swipelistview.SwipeListView
        android:id="@+id/example_swipe_lv_list"

        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        swipe:swipeFrontView="@+id/front"
        swipe:swipeBackView="@+id/back"
       android:background="?android:attr/activatedBackgroundIndicator"
        android:listSelector="@drawable/list_selector"
       android:choiceMode="singleChoice"
        swipe:swipeDrawableChecked="@drawable/choice_selected"
        swipe:swipeDrawableUnchecked="@drawable/choice_unselected"
        swipe:swipeCloseAllItemsWhenMoveList="true"

        swipe:swipeMode="both"
        />
main.xml
@可绘图/列表选择器

 <?xml version="1.0" encoding="utf-8"?>
  <selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@drawable/list_item_bg_normal" android:state_activated="false"/>
<item android:drawable="@drawable/list_item_bg_pressed" android:state_pressed="true"/>
<item android:drawable="@drawable/list_item_bg_pressed" android:state_activated="true"/>
<item android:drawable="@drawable/list_item_bg_normal" android:state_activated="true" ></item>

</selector>

在滚动列表视图时重复使用项目(视图)。要保持视图的现有状态,必须使用ViewHolder概念

查看以下链接:

将所选项目存储在数组中。继续检查项目是否存在,并更改getView()中的背景色