Pramod Pramod - 1 month ago 74
Android Question

Android sticky header RecyclerView/ Section Header RecyclerView

Hello All I have just created a demo to work with new android L widget RecyclerView.I have also implemented Pull-To-Refresh using SwipeRefreshLayout but problem for me now is how can I implement sticky header here,Because when i try to set

mRecyclerView.setOnScrollListener(new OnScrollListener() {

@Override
public void onScrolled(int arg0, int arg1) {

}

@Override
public void onScrollStateChanged(int arg0) {
// TODO Auto-generated method stub

}
});


I get only these 2 methods so dont have any idea how can I handle this...

Please help..

Answer

Since the previous answers don't provide a reliable solution, I propose my FlexibleAdapter library for RecyclerView, that is able to handle all following functionalities at once:

  • Sticky functionality for headers with Sections, works with all 3 LayoutManagers and with ViewPager too.
  • Selection Modes.
  • Multiple item types with auto-mapping.
  • Predefined ViewHolders.
  • Expandable items with Selection Coherence.
  • Draggable and Swipe-To-Dismiss.
  • Animated Async Filter with spannable text.
  • Scrolling Animations.
  • EndlessScroll with Adapter binding.
  • UndoHelper & ActionMode Helper.
  • FastScroller.
  • ...and more.

The idea behind is to avoid to create from scratch over again a custom Adapter for every project and to have more functionalities in one library, instead of relying on different libraries that support only 1 or 3 of them and that you cannot merge.