tags:

views:

133

answers:

1

I have a ListView in a ListActivity populated with strings. However, only the text-part of a list item is clickable, and when it is clicked, only the text-part is highlighted (orange on black background). I would like to make the full line clickable, and when selected, the full line should be marked as selected.

How can I do that? This is my layout XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/TextViewLocationMode" android:text="-"></TextView>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Statustekst" android:id="@+id/TextViewStatus"></TextView>
<ListView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@android:id/list" android:longClickable="true" android:clickable="true" android:choiceMode="singleChoice" android:fadeScrollbars="true" android:isScrollContainer="true"></ListView>
</LinearLayout>
+2  A: 

That is the default behaviour - are you sure your ListView and custom row layouts, if you're using some, are set to width="fill_parent"? If they are already on width="fill_parent", post up your XML and/or code so we can see what's wrong.

Steve H
Thanks, changing the XML to android:layout_width="fill_parent" fixed the problem.
Lars D