I am inflating a row multiple times in a scroll view linear Layout.i am trying to change the background color of the row which the user selects.But i am selecting the row only in some area it is changing the background color of the row .I am not getting why it is happening.Please help me.
ScrollView XML
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/mainScroll"
android:layout_marginTop="5dp" >
<LinearLayout
android:id="@+id/mainData"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
InnerLayout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/resultLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:background="@drawable/backgroundcolor"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/id1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:singleLine="true"
android:text="25 Sep 2013" />
<TextView
android:id="@+id/id2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:singleLine="true"
android:text="" />
<TextView
android:id="@+id/id3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:singleLine="true"
android:text="" />
<ImageView
android:id="@+id/id4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="5dp"
android:src="@drawable/ic"/>
</LinearLayout>
</LinearLayout>
BackgroundColor.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="false"
android:state_pressed="false"
android:drawable="@color/grey" />
<item android:state_pressed="true"
android:drawable="@color/itemselected" />
<item android:state_selected="true"
android:state_pressed="false"
android:drawable="@color/itemselected" />
</selector>
Color.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="grey">#ffffff</color>
<color name="itemselected">#EDEDED</color>
</resources>
Image as Image Link
It's working on selection but it is not filling the complete height of the layout.Please help me to find the issue