默認開啓只需要
<ListView
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>
不自動隱藏
listView.setFastScrollAlwaysVisible(true);
功能雖小,不過用戶體驗我覺得還是很不錯的~~
該功能需要API lever 11以上。