-1

I've a list view in my app. I want to implement fast scrollbar with alphabet suggestion in small bubble. For example:

enter image description here

I found the same for recycler view here.

I found a third party library for list view but don't know how to implement it in my project. Because there is no description for its use. Can anyone please suggest any alternative or mention steps to use this library in my project?

Thanks

Community
  • 1
  • 1
  • What about SuperSlim? I mean this [link](https://github.com/TonicArtos/SuperSLiM) – Mohammad Zarei Oct 23 '16 at 06:06
  • @MohammadZ I think this is also for recycler view see this https://github.com/TonicArtos/SuperSLiM/wiki/Getting%20started%20with%20version%200.4 –  Oct 23 '16 at 06:39

1 Answers1

0

As in example said, first of all, you must declare your view in XML:

<lb.library.PinnedHeaderListView
    android:id="@android:id/list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:cacheColorHint="@android:color/transparent"
    android:divider="@null"
    android:dividerHeight="0px"
    android:fadeScrollbars="false"
    android:fastScrollEnabled="true"
    android:listSelector="@drawable/listview_selector"
    android:scrollingCache="false"
    tools:listitem="@layout/listview_item"/>

listitem is layout of your single item.

After that in your activity,

private PinnedHeaderListView mListView;
mListView = (PinnedHeaderListView) findViewById(android.R.id.list);
int pinnedHeaderBackgroundColor = getResources().getColor(getResIdFromAttribute(this, android.R.attr.colorBackground));
mAdapter.setPinnedHeaderBackgroundColor(pinnedHeaderBackgroundColor);
mAdapter.setPinnedHeaderTextColor(getResources().getColor(R.color.pinned_header_text));
mListView.setPinnedHeaderView(mInflater.inflate(R.layout.pinned_header_listview_side_header, mListView, false));
mListView.setAdapter(mAdapter);
mListView.setOnScrollListener(mAdapter);
mListView.setEnableHeaderTransparencyChanges(false);
//    mAdapter.getFilter().filter(mQueryText,new FilterListener() ...
//You can also perform operations on selected item by using :
//    mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() ...

Note that your adapter must extends SearchablePinnedHeaderListViewAdapter<T>

Mohammad Zarei
  • 1,773
  • 14
  • 33