"分离器"在ListView控件 [英] "Separators" in ListView

查看:114
本文介绍了"分离器"在ListView控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 ArrayAdapter 这是迷上了我的的ListView 。我真的很喜欢在Evernote的Andr​​oid应用程序,在那里他们分开使用邮戳项目分隔符功能:

I have an ArrayAdapter which is hooked up to my ListView. I really like the "separators" feature in the Evernote Android application, where they separate items using a datestamp:

我想他们在做什么是具有立即被设置为当前的分离器的价值,因为你可以在屏幕看到列表上方的视图。 (当你滚过一个分离器,在顶部的文本设置为当前的分离,即2011年1月的值),我将如何实际插入分离到我的的ListView

I assume what they're doing is having a view immediately above the list which is set to the value of the current separator, as you can see in the screenshots. (As you scroll past a separator, the text at the top is set to the value of the current separator, ie "January 2011") How would I actually insert the separators into my ListView?

推荐答案

一个分隔符是一个简单的禁用列表项,只是你的适配器返回分离器,它应该是。好像<一href="http://developer.android.com/reference/android/widget/SectionIndexer.html"><$c$c>SectionIndexer能有所帮助。

A separator is simply a disabled list item, just have your Adapter return the separator where it should be. Seems like SectionIndexer could help.

这篇关于&QUOT;分离器&QUOT;在ListView控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆