Android : ListView selector stuck on screen after scrolling

on Friday, April 17, 2015


I've tried several combinations of selectors, but the end result is the same. Even though the selector is displayed correctly, if I go up or down the selector stays in the middle of the screen. It's exactly this issue, but I couldn't make it work with this or any other solutions I've found.


Selecting a rowScrolling down


My ListView:



<ListView
android:id="@+id/cardListView"
android:background="@android:color/black"
android:listSelector="@drawable/list_view_selector"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>


My list_view_selector.xml



<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="true"
android:drawable="@drawable/background_selected" />
<item
android:drawable="@drawable/background_selected" />
</selector>


And my background_selected



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

<gradient
android:angle="90"
android:centerColor="#ffffff"
android:endColor="#ffffff"
android:startColor="#ffffff" />

</shape>


Thanks in advance.


0 comments:

Post a Comment