OK, either I'm asking a stupid question or I'm not supplying enough
information (as I haven't got a response to this question).  Searching
Google hasn't helped; the ListView reference documentation hasn't helped.
So if I'm being stupid, please forgive me and kindly point me to the proper
documentation.

I want to create a ListView with a custom row that remains tappable and
long-tappable.

If I use the following row (lifted directly from Mark Murphy's book, p90),
everything works as expected:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:orientation="horizontal">
  <ImageView
     android:id="@+id/icon"
     android:layout_width="42px"
     android:paddingLeft="2px"
     android:paddingRight="2px"
     android:paddingTop="2px"
     android:layout_height="wrap_content"
     android:src="@drawable/icon"
  />
  <TextView
     android:id="@+id/label"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:textSize="44sp"
  />
</LinearLayout>

In Mark's example, the TextView objects are loaded with a bunch of words;
tapping a word puts it into another TextView outside the ListView.

However, adding a CheckBox to the layout breaks Mark's code so that tapping
the word no longer generates the click event:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:orientation="horizontal">
  <ImageView
     android:id="@+id/icon"
     android:layout_width="42px"
     android:paddingLeft="2px"
     android:paddingRight="2px"
     android:paddingTop="2px"
     android:layout_height="wrap_content"
     android:src="@drawable/icon"
  />
  <CheckBox android:id="@+tasklist_row/star"
      style="?android:attr/starStyle"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginLeft="4px"/>
  <TextView
     android:id="@+id/label"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:textSize="44sp"
  />
</LinearLayout>

It makes sense that tapping the CheckBox should toggle the star.  But I
would expect that tapping the TextView would still select and click the row
and it doesn't.  Similaraly, long-taps are now disabled...

So how do I restore the ability to tap and long-tap on the TextView?

Thanks in adavance and thanks for bearing with my newbie questions.


Regards,

Dave Orme

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to