Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use fast scroll in android?

People also ask

How can I make my Android scroll faster?

So if you'd like to adjust these, tap the three-dot menu button at the top of the screen, then head to the "Settings" entry. From here, the "Speed of scrolling" option lets you adjust how fast the automatic scrolling will be.

How do you use fast scroll?

Fast Scroll is a handy extension to increase your browser's scrolling speed. Easy to use To activate the increased speed, hold the Alt key while scrolling.

Can scroll vertically Android?

ScrollView is used to scroll the child elements of palette inside ScrollView. Android supports vertical scroll view as default scroll view. Vertical ScrollView scrolls elements vertically. Android uses HorizontalScrollView for horizontal ScrollView.


In the onCreate method of the ListActivity use setFastScrollEnabled:

getListView().setFastScrollEnabled(true);

Use android:fastScrollEnabled in your xml:

<ListView
    android:id="@+id/listview_files"
    ...
    android:fastScrollEnabled="true" >
</ListView>

Try the following

 <?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>

In your Manifest set the style like this:

<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/CustomTheme">

this is the listview

 <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"
         />

If you want to be able to customize your Fast-scroller, like choosing your own scroller image to appear, I recommend using this source:

https://github.com/nolanlawson/CustomFastScrollViewDemo/

Basically, your listview adapter will have to implement a sectionindexer. This section indexer can be very stripped if you don't want to complicate things and provide simple fastscrolling though the entire length of the list.

The direct source for the fastscroller is here:

https://github.com/nolanlawson/CustomFastScrollViewDemo/blob/master/src/com/nolanlawson/customfastscrollviewdemo/CustomFastScrollView.java

Place this view around your listview (nest your listview inside this view in your xml layout file) and set android:fastScrollEnabled="true" on your listview.

You might also want to check out a previous answer: Fast Scroll display problem with ListAdapter and SectionIndexer


I wanted to do something similar to what you wanted to achieve. I bumped into this post. It is a great way to implement fast scrolling without using the standard Android AlphabetIndexer, which requires a Cursor you might not always have.

Basically, you would have to implement the SectionIndexer interface in your adapter. In your case, instead of the current letter, you would show the current period as you scroll.