我使用fortysevendegree swipelistview
库生成了Listview。我想突出显示具有特定颜色的选定Listview行,而不是android中的默认荧光笔。我已完成以下代码,但我的整行获取颜色,小部件被屏蔽。如果我删除android:drawSelectorOnTop="true"
,则行上没有突出显示。谁能告诉我该怎么办?我的代码如下::
myactivity.xml
<com.fortysevendeg.swipelistview.SwipeListView
android:id="@+id/swipy"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
swipe:swipeFrontView="@+id/front"
swipe:swipeBackView="@+id/back"
android:focusable="true"
android:focusableInTouchMode="true"
android:listSelector="@drawable/list_selector"
android:drawSelectorOnTop="true"
android:dividerHeight="1dp"
swipe:swipeMode="right"
/>
可绘制文件夹中的listselector.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"/>
</selector>
drawable
中的list_item_bg_normal.xml<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="@color/list_background"
android:endColor="@color/list_background"
android:angle="90" />
</shape>
可绘制的list_item_bg_pressed.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="@color/list_background_pressed"
android:endColor="@color/list_background_pressed"
android:angle="90" />
</shape>