-
Notifications
You must be signed in to change notification settings - Fork 126
Header Tutorial
Turing Technologies (Wynne Plaga) edited this page Mar 24, 2017
·
4 revisions
This tutorial is designed for a situation in which you want to have headers of one size and elements of another. Because the vanilla scroll logic is counting on every element being the same size, it won't work properly in this situation without a bit of extra work on your part. Luckily, we've developed a special class to help you out. Just follow this tutorial for some easy help.
Implement IHeaderAdapter
and ICustomScroller
in your adapter class and include the required methods.
Fill out the method according to this guide.
FastScrollerUtil.HeaderScrollManager manager;
@Override
public boolean isHeader(int index) {
return //Is the view at 'index' a header//;
}
@Override
public void initScrollManager(int span) {
manager = new FastScrollerUtil.HeaderScrollManager(span);
manager.calcData(this);
}
@Override
public int getHeaderHeight() {
return //Height of a header view//;
}
@Override
public int getRowHeight() {
return //Height of a row//;
}
@Override
public int getDepthForItem(int index)
{
return manager.getDepthForItem(index);
}
@Override
public int getTotalDepth()
{
return manager.getTotalDepth();
}
@Override
public int getItemIndexForScroll(float scrollBarPos)
{
return manager.getItemIndexForScroll(scrollBarPos);
}
In the activity or fragment for the scroll bar add the following:
FastScrollerUtil.initHeaderScroller(//RecycelrView//);
This wiki available under the Apache License, Version 2.0. © 2015 - 2017 Turing Technologies