开发者

View like android's contact screen

I am developing an application with a large number of elements that must be ordered alphabetically, and I'd like it to have the same look and feel as android's contact list, That is

[Letter]
<contact>
<contact>
[Letter]
<contact>
<contact>
<contact>

etc.

Which is the best way to achieve this same layout? I've seen several tutorials concerning scrollable lists, but this is a bit different. I've looked a bit开发者_如何学编程 through android's source code, but if anyone has the answer, it would save me a lot of time.

Thanks in advance.


You could use my MergeAdapter for that, either directly or as a basis for creating your own adapter that gives you your desired look.

In a nutshell, you need to create a ListAdapter that handles both your contacts and your headings. You will wind up using different views for those, most likely, and there are methods you override on ListAdapter to each Android about those. You might also elect to say that the headings are not "enabled", meaning they will not respond to selection or click events.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜