I am creating a custom ListView as shown below
Main layout
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center">
<ListView android:id="@+id/listview"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_margin="3dip"
android:fadingEdge="none"
android:soundEffectsEnabled="true"
android:clickable="true"
android:scrollbars="none"
android:divider="#ffcccccc"
android:dividerHeight="1dip"
android:layout_weight="1"/>
</LinearLayout>
Custom listview
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/sellistitem">
<TextView
android:id="@+id/ListItem"
android:layout_width="wrap_content"
android:layout_height="30dip"
android:layout_margin="1dip"
android:textColor="@color/BLACK"
android:gravity="center_vertical"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:padding="5dip"/>
</RelativeLayout>
and selector as shown below
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/BLUE" />
<item android:drawable="@drawable/WHITE" />
</selector>
Removable
<resources>
<drawable name="WHITE">#ffffff</drawable>
<drawable name="BLUE">#ff0033cc</drawable>
</resources>
Having done this, part of the selection works fine. However, when I click on an item, the selected item blinks twice before actually switching to blue. It does not change to blue, as it should. How to remove this flashing effect?
Yours faithfully,
source
share