All Projects → TellH → Recyclerstickyheaderview

TellH / Recyclerstickyheaderview

Licence: apache-2.0
Sticky header view or suspending view for RecyclerView.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Recyclerstickyheaderview

Stacklayoutmanager
customized layoutmanager,let item pile up like stackview/类似最美有物卡片堆叠效果
Stars: ✭ 343 (-1.15%)
Mutual labels:  recyclerview, android-ui
recyclerfragment
An Android Fragment that displays a set of items in a RecyclerView.
Stars: ✭ 16 (-95.39%)
Mutual labels:  recyclerview, android-ui
Carouselrecyclerview
Carousel Recyclerview let's you create carousel layout with the power of recyclerview by creating custom layout manager.
Stars: ✭ 107 (-69.16%)
Mutual labels:  recyclerview, android-ui
Androidveil
🎭 An easy, flexible way to implement veil skeletons and shimmering effect for Android.
Stars: ✭ 792 (+128.24%)
Mutual labels:  recyclerview, android-ui
CeilingLayout
CeilingLayout用来控制子View的吸顶联滑,理论上支持实现了NestedScrollingChild的联滑控件,如NestedScrollView、RecyclerView、SmartRefreshLayout等;只需要在xml里配置需要吸顶子View的位置索引就能自动实现吸顶联滑效果。
Stars: ✭ 26 (-92.51%)
Mutual labels:  recyclerview, android-ui
Multilinedivider
Multi divider in RecyclerView on Android.
Stars: ✭ 13 (-96.25%)
Mutual labels:  recyclerview, android-ui
Pageindicator
An Instagram like page indicator compatible with RecyclerView and ViewPager.
Stars: ✭ 236 (-31.99%)
Mutual labels:  recyclerview, android-ui
Androidribbon
🎀 The simple way to implement a beautiful ribbon with the shimmering on Android.
Stars: ✭ 502 (+44.67%)
Mutual labels:  recyclerview, android-ui
android-tableview-kotlin
Android's missing TableView component.
Stars: ✭ 40 (-88.47%)
Mutual labels:  recyclerview, android-ui
recycler-adapter
RecyclerView-driven declarative UIs
Stars: ✭ 124 (-64.27%)
Mutual labels:  recyclerview, android-ui
Codeview Android
Display code with syntax highlighting ✨ in native way.
Stars: ✭ 748 (+115.56%)
Mutual labels:  recyclerview, android-ui
Tableview
TableView is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells.
Stars: ✭ 2,928 (+743.8%)
Mutual labels:  recyclerview, android-ui
Discretescrollview
A scrollable list of items that centers the current element and provides easy-to-use APIs for cool item animations.
Stars: ✭ 5,533 (+1494.52%)
Mutual labels:  recyclerview, android-ui
Easyadapter
Recyclerview adapter library- Create adapter in just 3 lines of code
Stars: ✭ 122 (-64.84%)
Mutual labels:  recyclerview, android-ui
Zoomrecylerlayout
🎢 Zoom Recycler Layout Manager For Android Kotlin
Stars: ✭ 618 (+78.1%)
Mutual labels:  recyclerview, android-ui
Notzz App
📝 A Simple Note-Taking App built to demonstrate the use of Modern Android development tools - (Kotlin, Coroutines, State Flow, Hilt-Dependency Injection, Jetpack DataStore, Architecture Components, MVVM, Room, Material Design Components).
Stars: ✭ 158 (-54.47%)
Mutual labels:  recyclerview, android-ui
Scrollingpagerindicator
Pager indicator inspired by Instagram. Lightweight and easy to set up.
Stars: ✭ 419 (+20.75%)
Mutual labels:  recyclerview, android-ui
movie-booking
An example for booking movie seat, combined of Android Data Binding, State Design Pattern and Multibinding + Autofactory. iOS version is: https://github.com/lizhiquan/MovieBooking
Stars: ✭ 80 (-76.95%)
Mutual labels:  recyclerview, android-ui
RecyclerELE
Android Library for easy addition of Empty, Loading and Error views in a RecyclerView
Stars: ✭ 27 (-92.22%)
Mutual labels:  recyclerview, android-ui
Fastadapter
The bullet proof, fast and easy to use adapter library, which minimizes developing time to a fraction...
Stars: ✭ 3,512 (+912.1%)
Mutual labels:  recyclerview, android-ui

RecyclerStickyHeaderView


Sticky header view or suspending view for RecyclerView.
StickyListHeaders is an Android library that makes it easy to integrate section headers stick to the top in ListView. Inspire by it, I setup this project to implement the same effect in RecyclerView.

Effect

Usage

Setup

root build.gradle

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

app build.gradle

dependencies {
   compile 'com.github.TellH:RecyclerStickyHeaderView:1.1.0'
}

Quick Start

  • Place RecylerView into StickyHeaderView
    <tellh.com.stickyheaderview_rv.StickyHeaderView
        android:id="@+id/stickyHeaderView"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/recyclerView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@android:color/white"
            android:scrollbars="vertical" />
    </tellh.com.stickyheaderview_rv.StickyHeaderView>

  • Create data bean class for each item type in RecyclerView. They should extend DataBean. Override the method
    public boolean shouldSticky() to decide whether the item view should be suspended on the top.
public class User extends DataBean {
    private String login;
    private int id;
    private String avatar_url;
    private boolean shouldSticky;
    @Override
    public int getItemLayoutId(StickyHeaderViewAdapter adapter) {
        return R.layout.item_user;
    }
    public void setShouldSticky(boolean shouldSticky) {
        this.shouldSticky = shouldSticky;
    }
    // Decide whether the item view should be suspended on the top.
    @Override
    public boolean shouldSticky() {
        return shouldSticky;
    }
}
public class ItemHeader extends DataBean {
    private String prefix;
    @Override
    public int getItemLayoutId(StickyHeaderViewAdapter adapter) {
        return R.layout.header;
    }
    @Override
    public boolean shouldSticky() {
        return true;
    }
}
  • Create ViewBinder to bind different type views with specific data beans. As you see, provideViewHolder(View itemView) corresponds for onCreateViewHolder in RecyclerView, and bindView corresponds for onBindViewHolder in RecyclerView.
public class ItemHeaderViewBinder extends ViewBinder<ItemHeader, ItemHeaderViewBinder.ViewHolder> {
    @Override
    public ViewHolder provideViewHolder(View itemView) {
        return new ViewHolder(itemView);
    }
    @Override
    public void bindView(StickyHeaderViewAdapter adapter, ViewHolder holder, int position, ItemHeader entity) {
        holder.tvPrefix.setText(entity.getPrefix());
    }
    @Override
    public int getItemLayoutId(StickyHeaderViewAdapter adapter) {
        return R.layout.header;
    }
    static class ViewHolder extends ViewBinder.ViewHolder {
        TextView tvPrefix;
        public ViewHolder(View rootView) {
            super(rootView);
            this.tvPrefix = (TextView) rootView.findViewById(R.id.tv_prefix);
        }
    }
}
  • Instantiate StickyHeaderViewAdapter for RecyclerView and register ViewBinders for each item types.
        rv = (RecyclerView) findViewById(R.id.recyclerView);
        rv.setLayoutManager(new LinearLayoutManager(this));
        List<DataBean> userList = new ArrayList<>();
        adapter = new StickyHeaderViewAdapter(userList)
                .RegisterItemType(new UserItemViewBinder())
                .RegisterItemType(new ItemHeaderViewBinder());
        rv.setAdapter(adapter);

That is all.

Please check out the Demo and source code for more information. If you have any question, feel free to raise an issue. Thanks a lot!

Thanks

License

Copyright 2016 TellH

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].