百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

SuperRecyclerView

> 编程语言
开源

加载的 RecyclerView

2.6K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

加载的 RecyclerView

##Description

This is an attempt to make RecyclerView easier to use.

Features built in:

  • ProgressBar while adapter hasn't been set
  • EmptyView if adapter is empty
  • SwipeRefreshLayout (Google's one)
  • Infinite scrolling, when you reach the X last item, load more of them.
  • Swipe To Dismiss or Swipe To Remove
  • Sticky headers (via Eowise, see sample)

##Integration

Just add it to you dependencies

    compile 'com.malinskiy:superrecyclerview:$version'

##Usage

  • Use directly SuperRecyclerView:
   <com.malinskiy.superrecyclerview.SuperRecyclerView
            android:id="@+id/list"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_empty="@layout/emptyview"
            app:layout_moreProgress="@layout/view_more_progress"
            app:mainLayoutId="@layout/layout_recyclerview_verticalscroll"
            app:recyclerClipToPadding="false"
            app:recyclerPadding="16dp"
            app:scrollbarStyle="insideInset"/>
  • Current Attributes supported:
…

##SuperRecyclerView Java Usage

…

##Scrollbars RecyclerView currently doesn't support setting scrollbars from code that's why I can't parse custom attributes. You have to use appropriate mainLayoutId attribute to have scrollbars visible.

Vertical scrollbars

<com.malinskiy.superrecyclerview.SuperRecyclerView
     app:mainLayoutId="@layout/layout_recyclerview_verticalscroll"
     app:scrollbarStyle="insideInset"
     .../>

Horizontal scrollbars

<com.malinskiy.superrecyclerview.SuperRecyclerView
     app:mainLayoutId="@layout/layout_recyclerview_horizontalscroll"
     app:scrollbarStyle="insideInset"
     .../>

##Swipe layout

  1. You should always assign android:id to @id/recyclerview_swipe. Note that it's a reference to an already defined id, so don't use @+id

  2. The SwipeLayout can only have 2 children that are instances of ViewGroup, e.g. LinearLayout, RelativeLayout, GridLayout

  3. The first child is the bottom view, the second child is the top view

  4. Your adapter should extend BaseSwipeAdapter class

  5. Do not setup swipe to dismiss and use swipe layout at the same time. If you do - a kitten will cry somewhere.

Item example:

<com.malinskiy.superrecyclerview.swipe.SwipeLayout
    android:id="@id/recyclerview_swipe"
    xmlns:swipe="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    swipe:horizontalSwipeOffset="16dp">

    <LinearLayout
        ...
    </LinearLayout>

    <LinearLayout
        ...
    </LinearLayout>

</com.malinskiy.superrecyclerview.swipe.SwipeLayout>

Custom attributes supported:

    <attr name="drag_edge" format="enum">
        <enum name="left" value="0"/>
        <enum name="right" value="1"/>
        <enum name="top" value="2"/>
        <enum name="bottom" value="3"/>
    </attr>
    <attr name="horizontalSwipeOffset" format="dimension"/>
    <attr name="verticalSwipeOffset" format="dimension"/>
    <attr name="show_mode" format="enum">
        <enum name="lay_down" value="0"/>
        <enum name="pull_out" value="1"/>
    </attr>

####Sample java

Proguard

-dontwarn com.malinskiy.superrecyclerview.SwipeDismissRecyclerViewTouchListener*

##Thanks Jake Warthon for implementation of SwipeToDismiss via NineOldAndroids

Eowise for implementation of sticky headers

Quentin Dommerc for inspiration

代码家 for swipe layout implementation

##License

Copyright (c) 2016 Anton Malinskiy

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.
Come on, don't tell me you read that.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Java

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言