我有一个是通过月份和年份分隔的事件列表(2010年6月,2010年7月等)如何在android中使用快速滚动?
我想启用快速滚动,因为名单是很长的。
如何启用在Android的ListViews
快速滚动?
我有一个是通过月份和年份分隔的事件列表(2010年6月,2010年7月等)如何在android中使用快速滚动?
我想启用快速滚动,因为名单是很长的。
如何启用在Android的ListViews
快速滚动?
在ListActivity使用setFastScrollEnabled的onCreate方法:
getListView().setFastScrollEnabled(true);
使用android:fastScrollEnabled在你的XML:
<ListView
android:id="@+id/listview_files"
...
android:fastScrollEnabled="true" >
</ListView>
如果你希望能够自定义您的快速滚动,例如选择自己的滚动形象出现,我建议使用此来源:
https://github.com/nolanlawson/CustomFastScrollViewDemo/
基本上,你的ListView适配器将不得不实施sectionindexer。本节索引器,如果你不想要的东西复杂化,并提供简单的fastscrolling好像列表的整个长度上非常精简。
的直接来源为fastscroller是在这里:
将在你的列表视图(鸟巢您的ListView这一观点在你的XML布局文件中),并设置Android的这一观点:fastScrollEnabled =“真”在你的listview上。
你可能也想看看以前的答案:Fast Scroll display problem with ListAdapter and SectionIndexer
如果你想显示字母索引,你可能要检查了这一点:
https://github.com/andraskindler/quickscroll
这是一个图书馆项目我创建的,因为我曾在最近的一些应用程序来使用这个滚动图形,所以我想其他人可能也感兴趣。这很容易使用,请参阅上面的github链接中的自述文件。
请尝试以下
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="listviewfastscrollstyle" parent="android:Theme">
<item name="android:fastScrollTrackDrawable">@drawable/listselector</item>
<item name="android:fastScrollThumbDrawable">@drawable/listselector</item>
</style>
</resources>
在你的清单中设置的风格是这样的:
<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/CustomTheme">
这是列表视图
<ExpandableListView
android:id="@android:id/list1"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:drawSelectorOnTop="false"
android:fastScrollAlwaysVisible="true"
android:fastScrollEnabled="true"
/>
好吧我可以做日期快速滚动,我的意思是,当执行快速滚动时,我可以显示记录的日期,如通话历史中的一个 – Rakshi 2013-05-15 11:24:17
我想要做类似的东西给你想实现。我撞到this post。它是实现快速滚动,而无需使用标准的Android AlphabetIndexer,这需要一个游标你可能并不总是有一个伟大的方式。
基本上,你就必须实现您的适配器SectionIndexer接口。在你的情况下,而不是当前的信件,你会滚动显示当前的时间段。
要么在您的xml中定义fastScrollEnabled,要么在需要时将其设置为运行时。
1) <ListView
...
android:fastScrollEnabled="true" />
2) mListView.setFastScrollEnabled(true);
在布局文件:
机器人:fastScrollEnabled = “真”
您可以通过编程启用快速滚动条:
getListView()setFastScrollEnabled(真正);
注意:只有当listview总高度比listview的可见高度大4倍或更多时才会显示。 – 2012-03-28 03:20:43
@mice:是否有关于您评论的文档? – 2012-12-20 05:36:57
可能没有记录,该条件在源代码中找到。 – 2012-12-20 09:01:51