Mika
Mika

Reputation: 5845

Better way for header in ListView

I want to show a fairly complex header above an ExpandableListView. The header basically holds some artwork and some text. When I scroll the List I want the header to scroll off the screen.

I can do it by adding a section to the list view with no children but it makes my BaseExpandableListAdapter very clunky. does anyone know of a better way. I've tried adding the header in the xml before the ExpandableListView tags but that makes it static at the top of the page when I scroll the ExpandableListView.

Upvotes: 0

Views: 94

Answers (1)

Ilya Demidov
Ilya Demidov

Reputation: 3305

if you do not like native View header http://developer.android.com/reference/android/widget/ListView.html#addHeaderView(android.view.View) you can inflate special view and return it in the first position in your Adapter. Actually we make adapter to control getting view in our ListView. So you can always return special views in special positions and for me that is ok. Not always view in your ListView must be similar. You just need to implement some populating logic for all this views.

Good luck!

Upvotes: 1

Related Questions