hc wrote:
> In a list, is it possible to have different kind of views, inflated
> from different layout XML?

Sure!

> How am I able to have certain rows with layout inflated from a
> different XML? The method above seems to assume that all of them will
> have the same kind of layout.

1. Override getViewTypeCount() to return the distinct number of types of
layouts you are using.

2. Override getItemViewType(int position) to return the 0-based index of
the type of layout you are going to use for the indicated item in the list.

At this point, getView() will only be passed a convertView to be
recycled if it is of the proper type.

> I wish to make the last row a view with
> a Next/Previous button, and add rows with different layout in the
> middle of the list.

I wouldn't recommend that approach. The getItemViewType() mechanism does
not seem to support the notion of row positions changing type. If you
make your Next/Previous button a row, that row will need to keep the
same position, otherwise the row caching may break.

I would recommend putting the next/previous button outside the list.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com

Android Training on the Ranch! -- Mar 16-20, 2009
http://www.bignerdranch.com/schedule.shtml

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