Re: [android-developers] ListView with multiple layouts formats in it
hi, noid, this article may help you, Separating Lists with Headers in Android 0.9: http://diigo.com/0anhm -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] ListView with multiple layouts formats in it
noid wrote: > I'm trying to create a ListView that has different layouts in it. > Basically headers which contain only one string, and then items under > the headers that have a string and a picture. So something like > > > HEADER A > img1 : item A1text > img2 : item A2 text > img3 : item A3 text > HEADER B > img1 : item B1text > img2 : item B2 text > > I've created a custom ArrayAdapter, but the constructor takes a > textViewResourceId which specifies what layout the items in the list > will use to display. My problem is I have 2 formats. One for the > header and one for the item. So in the below example, OrderAdapter is > passed R.layout.header. (header is defined by header.xml). > > this.m_adapter = new OrderAdapter(this, R.layout.header, m_orders); > > I need OrderAdapter to handle R.layout.header AND R.layout.item > (item.xml defines a ImageView and a textView, header.xml only defines > TextView). Your OrderAdapter handles this in its implementations of: getView() getItemViewType() getViewTypeCount() areAllItemsEnabled() isEnabled() -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Consulting: http://commonsware.com/consulting -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] ListView with multiple layouts formats in it
I'm trying to create a ListView that has different layouts in it. Basically headers which contain only one string, and then items under the headers that have a string and a picture. So something like HEADER A img1 : item A1text img2 : item A2 text img3 : item A3 text HEADER B img1 : item B1text img2 : item B2 text I've created a custom ArrayAdapter, but the constructor takes a textViewResourceId which specifies what layout the items in the list will use to display. My problem is I have 2 formats. One for the header and one for the item. So in the below example, OrderAdapter is passed R.layout.header. (header is defined by header.xml). this.m_adapter = new OrderAdapter(this, R.layout.header, m_orders); I need OrderAdapter to handle R.layout.header AND R.layout.item (item.xml defines a ImageView and a textView, header.xml only defines TextView). How is this done? Thanks -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en