title: custom android listview item not selectable on the whole area
body: <p>I am using a ListView with a custom adapter for displaying items as pairs of title/subtitle TextViews.</p>
  
  <p>Unfortunately, I can select an item just by clicking on its upper half, the one occupied by the title</p>
  
  <p>Here is the code I am using:</p>
  
  <p>journal_list.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;ListView
      android:id="@android:id/list"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:drawSelectorOnTop="false"
      android:background="#fff"
      android:cacheColorHint="#fff"
      android:paddingBottom="6dp"
  /&gt;
  </code></pre>
  
  <p>journal_list_item.xml for the list item's layout</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:descendantFocusability="blocksDescendants"
            &gt;
  &lt;TextView
      android:id="@+id/journal_entry_date"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:textStyle="bold"
      android:textColor="#000"
      android:textSize="18sp"
  
      android:layout_alignParentTop="true"
      android:layout_alignParentLeft="true"
  /&gt;
  &lt;TextView
      android:id="@+id/journal_content"
      android:paddingLeft="28dp"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:textSize="16sp"
      android:textColor="#555"
      android:inputType="textMultiLine"
      android:maxLines="2"
      android:minLines="1"
      android:layout_below="@id/journal_entry_date"
      android:layout_alignParentLeft="true"
  /&gt;
  </code></pre>
  
  <p></p>
  
  <p>Also the code for the adapter:</p>
  
  <pre><code>private class JournalAdapter extends ArrayAdapter&lt;JournalEntry&gt; {
      Context ctxt;
      public JournalAdapter(Context ctxt) {
          super(ctxt, R.layout.journal_list_item);
          this.ctxt = ctxt;
      }
      public View getView(int position, View convertView, ViewGroup parent) {
          View row = convertView;
          JournalHolder holder;
          if (row == null) {
              row = ((LayoutInflater)ctxt.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).
                      inflate(R.layout.journal_list_item, parent, false);
              holder = new JournalHolder(row);
              row.setTag(holder);
          } else {
              holder = (JournalHolder) row.getTag();
          }
          JournalEntry crt = getItem(position);
          holder.getDate().setText(crt.dateWritten);
          holder.getContent().setText(crt.content);
  
          return row;
      }
  }
  
  private static class JournalHolder {
      private TextView date;
      private TextView content;
      private View base;
  
      public JournalHolder(View base) {
          this.base = base;
      }
      public TextView getDate() {
          if (date == null)
              date = (TextView) base.findViewById(R.id.journal_entry_date);
          return date;
      }
      public TextView getContent() {
          if (content == null)
              content = (TextView) base.findViewById(R.id.journal_content);
          return content;
      }
  }
  </code></pre>
  
  <p>Code from the ListActivity's onCreate() method:</p>
  
  <pre><code>private JournalAdapter adapter;
  
  @Override
  public void onCreate(Bundle icicle) {
      super.onCreate(icicle);
      setContentView(R.layout.journal_list);
      adapter = new JournalAdapter(this);
      setListAdapter(adapter);
      registerForContextMenu(getListView());
  }
  </code></pre>
  
  <p>Also, I am calling a method called updateList() in onResume()</p>
  
  <pre><code>private void updateList() {
      adapter.clear();
      Cursor cursor = helper.listJournal(start, end);
      cursor.moveToFirst();
      JournalEntry crt;
      while (!cursor.isAfterLast()) {
          crt = new JournalEntry();
          crt.dateWritten = cursor.getString(cursor.getColumnIndex("date_written"));
          crt.content = cursor.getString(cursor.getColumnIndex("content"));
          crt.id = cursor.getInt(cursor.getColumnIndex("entry_id"));
          adapter.add(crt);
          cursor.moveToNext();
      }
      cursor.close();
      adapter.notifyDataSetChanged();
  }
  </code></pre>
  
  <p>List item clicking is handled in the onListItemClick of my ListActivity, as follows:</p>
  
  <pre><code>@Override
  public void onListItemClick(ListView l, View v, int position, long id) {
      Intent intent = new Intent(this, JournalEditor.class);
      intent.setAction(Intent.ACTION_EDIT);
      intent.putExtra("entry_id", adapter.getItem(position).id);
      startActivity(intent);
  }
  </code></pre>
  
  <p>Apparently, I am forgetting something important, and that's why this whole weird thing happens.</p>
  
  <p>I have found a similar discussion here: <a href="http://groups.google.com/group/android-developers/browse_thread/thread/5636c8ea74033657" rel="nofollow">http://groups.google.com/group/android-developers/browse_thread/thread/5636c8ea74033657</a> but it wasn't very helpful.</p>