Add these methods to your list-view's adapter:

@Override
public boolean areAllItemsEnabled() {
  return false;
}

@Override
public boolean isEnabled(int position) {
   return !itemIsHeader(position);
}

where you implement the itemIsHeader based on the position in the
adapter. If the item on the given position is a header, return false,
otherwise true.

Note, however, that a disabled list-item's separators disappear.




On Nov 16, 5:01 pm, Neilz <[email protected]> wrote:
> Hi Kostya.
>
> At first glance, your solution does not look that much different by
> the one suggested by Thierry above. Essentially, there's an alteration
> to the list row view where a header is present - or in your case a
> different list row view.
>
> The problem with Thierry's solution (for me) was that if you pressed
> the header, the rest of the list item was highlighted - it was still
> clickable. I want the separator to be completely untied to the list
> item, so that if you click it, nothing happens.
>
> Does your solution act in this manner?
>
> On Nov 16, 1:49 pm, Kostya Vasilyev <[email protected]> wrote:
>
>
>
> > Ok, here it is:
>
> >http://kmansoft.wordpress.com/2010/11/16/adding-group-headers-to-list...
>
> > -- Kostya
>
> > 15.11.2010 21:48, Neilz пишет:
>
> > > Yes please Kostya, and thanks for your input :-)
>
> > > On Nov 15, 5:50 pm, Kostya Vasilyev<[email protected]>  wrote:
> > >> Since this came up before, and generally *seems* useful, should I post
> > >> the entire recipe somewhere? (i.e. my blog)?
>
> > >> 15.11.2010 20:32, Neilz пишет:
>
> > >>> Maybe I can shuffle the order of your long list ;-)
> > >>>> Yes and yes, though probably not easily. You might consider Kostya's
> > >>>> approach. Creating a CursorHeadingAdapter or some such is on my
> > >>>> 18,000-item to-do list.
> > >> --
> > >> Kostya Vasilyev -- WiFi Manager + pretty widget 
> > >> --http://kmansoft.wordpress.com
>
> > --
> > Kostya Vasilyev -- WiFi Manager + pretty widget 
> > --http://kmansoft.wordpress.com- Hide quoted text -
>
> - Show quoted text -

-- 
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