-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is an own RecyclerView really needed? #4
Comments
No, it is not required. You can add the |
Oh great! |
Using the included example: private FastScroller fastScroller;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ExampleAdapter adapter = new ExampleAdapter();
RecyclerView recyclerView = findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(adapter);
fastScroller = findViewById(R.id.fast_scroller);
fastScroller.setSectionIndexer(adapter);
fastScroller.attachRecyclerView(recyclerView);
}
@Override
protected void onDestroy() {
fastScroller.detachRecyclerView();
super.onDestroy();
}
private static class ExampleAdapter extends RecyclerView.Adapter<ExampleAdapter.ViewHolder> implements FastScroller.SectionIndexer {
...
@Override
public String getSectionText(int position) {
return String.valueOf(mItemList.get(position).charAt(0));
}
} <android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.l4digital.fastscroll.FastScroller
android:id="@+id/fast_scroller"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="end"
app:bubbleColor="@color/fastscroll_bubble"
app:bubbleTextColor="@color/fastscroll_text"
app:handleColor="@color/fastscroll_handle" /> |
@randr0id Thanks a lot. I'll try it in the next days. |
@randr0id I guess, you need to add this way into readme |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Have a look here: https://github.com/turing-tech/MaterialScrollBar
The text was updated successfully, but these errors were encountered: