默认开启只需要
<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/listView"
android:fastScrollEnabled="true"
/>
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/listView"
android:fastScrollEnabled="true"
/>
而且会自动隐藏
如果需要自己定义:
(可以参考Deskclock里 com.android.deskclock/.worldclock.CitiesActivity)
<style name="CitiesTheme" parent="SettingsTheme">
<item name="android:fastScrollThumbDrawable">@drawable/red_fastscroll_thumb</item>
</style>
<item name="android:fastScrollThumbDrawable">@drawable/red_fastscroll_thumb</item>
</style>
不自动隐藏
listView.setFastScrollAlwaysVisible(true);
功能虽小,不过用户体验我觉得还是很不错的~~
该功能需要API lever 11以上。