Hannoun Yassir
Hannoun Yassir

Reputation: 21182

Implement a list with section divider in android

Hi how can i implement a list with section divider like the one on android's building blocks lists

enter image description here

Can you point any articles or tutorials to achieve this?

Upvotes: 13

Views: 7188

Answers (3)

steprobe
steprobe

Reputation: 1699

I implemented a possible version here:

http://steprobe.wordpress.com/2013/03/29/google-building-blocks-style-listview-for-android/

Upvotes: 14

Marcin Orlowski
Marcin Orlowski

Reputation: 75619

Each row in your list can be totally separated in terms of layout from others. So if you got 3 rows on your list, you can have each one can look totally different. You need to write your own adapter (i.e. extending ArrayAdapter), override getView(), getViewTypeCount() and getItemViewType(). Then for each row your getView() shall do any logic you want, inflate any layout you want and return that View to the list.

Upvotes: 1

Jorge
Jorge

Reputation: 487

There are many tutorials to get grouped lists. The trick is to look for "adapter" and not "list". For instance, this one: http://android.cyrilmottier.com/?p=440

Upvotes: 3

Related Questions