-
Notifications
You must be signed in to change notification settings - Fork 29
Sticky
Roman Tcaregorodtcev edited this page Oct 30, 2019
·
1 revision
Sticky mode allows you to easily create sticky elements for RecyclerView using a LinearLayoutManager in either vertical or horizontal orientation.
- Create your own RecyclerView.Adapter class.
- Create "Sticky" ViewHolder.
- Implement
StickyAdapter<T extends RecyclerView.ViewHolder>
(T it's your "Sticky" ViewHolder). - Override methods from StickyAdapter interface (You can look at full example here StickyHeaderAdapter.class).
public interface StickyAdapter<T extends RecyclerView.ViewHolder> {
long getStickyId(int position);
T onCreateStickyViewHolder(ViewGroup parent);
void onBindStickyViewHolder(T viewHolder, int position);
}
- Specify stickyMode inside your xml file. Possible variants: Header, Middle. By default we use Header mode.
<com.omega_r.libs.omegarecyclerview.OmegaRecyclerView
android:id="@+id/recycler_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:stickyMode="Header" />
-
- ViewPager Transformers
- AccordionTransformer
- BackgroundToForegroundTransformer
- CubeInTransformer
- CubeOutTransformer
- DepthPageTransformer
- FadeTransformer
- FlipTransformer
- ForegroundToBackground
- RotateDownTransformer
- RotateUpTransformer
- StackTransformer
- TabletTransformer
- ZoomInTransformer
- ZoomOutSlideTransformer