Java snapping Kotlin recyclerview
Need help with GravitySnapHelper?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.


A SnapHelper that snaps a RecyclerView to an edge.

4.6K Stars 605 Forks Apache License 2.0 146 Commits 2 Opened issues

Services available

Need anything else?


A SnapHelper that snaps a RecyclerView to an edge.


Add this to your build.gradle:

implementation 'com.github.rubensousa:gravitysnaphelper:2.2.1'

How to use

You can either create a GravitySnapHelper, or use GravitySnapRecyclerView.

If you want to use GravitySnapHelper directly, you just need to create it and attach it to your RecyclerView:

val snapHelper = GravitySnapHelper(Gravity.START)

If you want to use GravitySnapRecyclerView, you can use the following xml attributes for customisation:


Start snapping

val snapHelper = GravitySnapHelper(Gravity.START)

Center snapping

val snapHelper = GravitySnapHelper(Gravity.CENTER)

Limiting fling distance

If you use setMaxFlingSizeFraction or setMaxFlingDistance you can change the maximum fling distance allowed.

With decoration


  1. setMaxFlingDistance or setMaxFlingSizeFraction - changes the max fling distance allowed.
  2. setScrollMsPerInch - changes the scroll speed.
  3. setGravity - changes the gravity of the SnapHelper.
  4. setSnapToPadding - enables snapping to padding (default is false)
  5. smoothScrollToPosition and scrollToPosition
  6. RTL support out of the box

Nested RecyclerViews

Take a look at these blog posts if you're using nested RecyclerViews

  1. Improving scrolling behavior of nested RecyclerViews

  2. Saving scroll state of nested RecyclerViews


Copyright 2018 The Android Open Source Project
Copyright 2019 Rúben Sousa

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

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.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.