TonicArtos / SuperSLiM

A layout manager for the RecyclerView with interchangeable linear, grid, and staggered displays of views, all with configurable section headers including the sticky variety as specified in the material design docs.
http://tonicartos.nz
2.12k stars 296 forks source link

RecycleView scrolls over sticky header #222

Open dbroy05 opened 7 years ago

dbroy05 commented 7 years ago

I want to have a RecyclerView with gridview with sticky section headers. Everything looks good, but the while scrolling the list, it scrolls over the sticky header - which should scroll underneath of sticky header. Please help.

build.gradle : compile 'com.tonicartos:superslim:0.4.+'

in Adapter:

public void onBindViewHolder(final SuperHolder holder, final int position) {
final PItem mygift = itemsWithHeaders.get(position);

    final GridSLM.LayoutParams params = GridSLM.LayoutParams.from(holder.itemView.getLayoutParams());
    params.setSlm(GridSLM.ID);
    params.setFirstPosition(0);
    params.setColumnWidth(mContext.getResources().getDimensionPixelSize(R.dimen.grid_column_width));
    holder.setLayoutParams(params);
    holder.bindItem(mygift);
}

In section_header.xml:

<TextView android:id="@+id/header" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/md_grey_700" android:textColor="@color/clr_white" android:gravity="start" android:padding="6dip" android:textDirection="locale" android:textSize="24sp" app:slm_headerDisplay="sticky|inline" app:slm_isHeader="true" app:slm_section_headerMarginStart="match_header" />