Подтвердить что ты не робот

Ширина кликабельной области в ListView w/onListItemClick

Я пытаюсь получить элементы списка в доступном клиенте ListView. На данный момент они доступны для просмотра (см. Мой скриншот), но они доступны только в пределах прямоугольника, который занимает текст.

Я использую protected void onListItemClick(ListView l, View v, int position, long id) { для элементов с интерактивным списком.

Вот мой список .xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content"
    android:layout_height="wrap_content">
<ListView android:id="@+id/android:list"
      android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>
<TextView android:id="@+id/android:empty"
      android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/no_favorites"/>

и мой row.xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical" >
    <TextView android:id="@+id/artist"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>
    <TextView android:id="@+id/songtitle"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:layout_alignParentRight="true"/>
    <TextView android:id="@+id/album"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:layout_alignParentRight="true"/>
    <TextView android:id="@+id/playtime"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:layout_alignParentRight="true"/>
    <TextView android:id="@+id/playlistnum"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:layout_alignParentRight="true"
        android:visibility="gone" />
</LinearLayout>

И здесь пример скриншота: (Новые пользователи не могут размещать изображения... ворчать... есть гиперссылка!)

В list.xml Listview имеет android: layout_width = "fill_parent", поэтому должна быть полная ширина экрана. (Все элементы в row.xml также width = "fill_parent".) Что мне не хватает?

4b9b3361

Ответ 1

TextView в вашем list.xml должен быть установлен на fill_parent. Затем выбор будет соответствовать ширине родительского ListView.

      android:layout_width="wrap_content"