Android-ScrollBarPanel allows to attach a View to a scroll indicator like it's done in Path 2.0.
- Supports custom View as ScrollBarPanel.
Repository at https://github.com/rno/Android-ScrollBarPanel.
<!--
The ExtendedListView replaces a standard ListView widget
and provides the ScrollBarPanel capability.
-->
<com.dafruits.android.library.widgets.ExtendedListView
xmlns:dafruits="http://schemas.android.com/apk/res/YOUR_APP_PACKAGE_NAME"
android:id="@android:id/list"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
dafruits:scrollBarPanel="@layout/YOUR_SCROLLBARPANEL_LAYOUT"
dafruits:scrollBarPanelInAnimation="@anim/YOUR_ANIMATION"
dafruits:scrollBarPanelOutAnimation="@anim/YOUR_ANIMATION" />
// Set your scrollBarPanel
ExtendedListView listView = (ExtendedListView) findViewById(android.R.id.list);
// Attach a position changed listener on the listview and play with your scrollBarPanel
// when you need to update its content
mListView.setOnPositionChangedListener(new OnPositionChangedListener() {
@Override
public void onPositionChanged(ExtendedListView listView, int firstVisiblePosition, View scrollBarPanel) {
((TextView) scrollBarPanel).setText("Position " + firstVisiblePosition);
}
});
I will gladly accept pull requests for fixes and feature enhancements but please do them in the dev branch. The master branch is for the latest stable code, dev is where I try things out before releasing them as stable. Any pull requests that are against master from now on will be closed asking for you to do another pull against dev.
- first commit :-)
- added scrollBarPanel attribute to ExtendedListView
- Optimisations
- More precision regarding scrollBarPanel fade in and fade out (Thanks Cyril Mottier for the tip!)
- Use the position the scrollbar thumb is on instead of the firstVisibleItem position.
- Fix NPE (Thanks to Chris Banes)
- Added attributes to ExtendedListView to customize in / out animation of scrollBarPanel
Licensed under the Apache License, Version 2.0