When I click on any Horizontal Listview item , at a time three alternative items get highlighted and it wont unselect. Same Xml file which I applied to Horizontal Listview for highlighting background is worked perfectly for Gridview items. But I don't understand what goes wrong about Horizontal Listview. Here is my code.
XML file in drawable. Highlight_listview.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="false"
android:state_pressed="false"
android:drawable="@color/listview_backgroung_color" />
<item android:state_pressed="true"
android:drawable="@color/orange" />
<item android:state_selected="true"
android:state_pressed="false"
android:drawable="@color/abc_input_method_navigation_guard" />
</selector>
Above code works perfectly for gridview.
xml file where HorizontalListview has mentioned. Search_coupon.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#fff"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingLeft="10dp"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="98dp">
<shoanddonate.citytit.in.shopanddonate.HorizontalListView
android:id="@+id/listview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top"
android:clickable="true"/>
</FrameLayout>
</LinearLaout>
xml file from where data for list has fetched. row_cat.xml
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="170dp"
android:layout_height="wrap_content"
android:background="@drawable/Highlight_listview">
<RelativeLayout
android:layout_width="150dp"
android:layout_height="103dp">
<!--Image fetched from network-->
<com.android.volley.toolbox.NetworkImageView
android:id="@+id/cat_icon"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_centerHorizontal="true"
android:paddingTop="10dp"
android:layout_gravity="center"
android:clickable="false"
android:focusable="false"/>
<TextView
android:id="@+id/txt_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/CategoryColor"
android:textSize="14sp"
android:textStyle="bold"
android:layout_below="@+id/cat_icon"
android:gravity="center_horizontal"/>
</RelativeLayout>
</LinearLayout>