Javier Manzano
Javier Manzano

Reputation: 4831

ListView with headers

I now how to make a ListView with headers (there are tons of examples), but what I want to do is a ListView with headers and when one of the sections scrolls, the header would still be there.

I think I found one... but now I cannot find it again...

It's just like Contacts app. I hope you can help me!

Thanks

Upvotes: 0

Views: 185

Answers (3)

Android Killer
Android Killer

Reputation: 18509

Just a trick you may go for it:

Take LinearLayout with vertical orientation

  1. Put one textview with width fill_parent and height Wrap_content
  2. Then put your ListView with both height and width fill_parent.

Hope it will work. :)

Upvotes: 3

bindal
bindal

Reputation: 1932

You can use listView.addheader(yourlayout) method to add the header

priavate ListView l1;
extend your listView from layout 
use this
Create a view For Header in your main layout file
l1.addHeaderView(View v) to add Header

Upvotes: -1

Vladimir
Vladimir

Reputation: 3822

Just put another layout before ListView

Upvotes: 0

Related Questions