I have built a home screen widget that uses a list view and list items with a relative layout that contains two text views and an image view. What I want is that when you click on an item in the list view the full item should be selected and not as now only the text view or image view that you happen to click on. How can I do this? I have tried some stuff but nothing worked. Bellow is an image that shows how it looks now.
Here is the widget layout,
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="0dp"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#80FFFFFF"
android:orientation="horizontal" >
<ImageView
android:id="@android:id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:contentDescription="@string/widget_icon_description"
android:src="@drawable/ic_logo" />
<TextView
android:id="@android:id/text1"
style="@android:style/TextAppearance.DeviceDefault.Large.Inverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:text="@string/widget_list_heading"
android:textIsSelectable="false" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/holo_blue_bright"
android:paddingBottom="2dp" >
</LinearLayout>
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_marginBottom="0dp"
android:layout_weight="1"
android:background="#f1f1f1"
android:listSelector="@android:color/holo_blue_bright"
android:paddingBottom="0dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/holo_blue_bright"
android:paddingBottom="2dp" >
</LinearLayout>
And here is the list view item layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:background="@drawable/list_selector_background_light" >
<TextView
android:id="@android:id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMediumInverse"
android:textIsSelectable="false"
android:textStyle="bold" />
<TextView
android:id="@android:id/text2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@android:id/text1"
android:layout_below="@android:id/text1"
android:textAppearance="?android:attr/textAppearanceSmallInverse"
android:textIsSelectable="false" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:paddingRight="10dip"
android:paddingTop="8dip" >
<ImageView
android:id="@android:id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/expandable_heading_list_item_image_description" />
</LinearLayout>
/Viktor