GravitySnapHelper is a SnapHelper for Android that snaps a RecyclerView to an edge.
The tool addresses the problem of controlling how RecyclerView items align when scrolling stops. Android's standard SnapHelper implementations offer limited control over snapping behavior and gravity direction. GravitySnapHelper extends SnapHelper to let developers specify which edge items should snap to—start, end, or center—and provides fine-grained control over fling dynamics through maximum fling distance limits and scroll speed adjustments.
Developers building Android apps with horizontally or vertically scrolling lists should consider this tool if they need edge-aligned snapping with directional control. It suits projects using nested RecyclerViews, where standard snapping behavior can cause scroll conflicts. The tool can be integrated either by instantiating GravitySnapHelper directly and attaching it to a RecyclerView, or by using the provided GravitySnapRecyclerView subclass with XML attributes for configuration. Key capabilities include adjustable fling distance via setMaxFlingDistance or setMaxFlingSizeFraction, scroll speed control through setScrollMsPerInch, gravity selection via setGravity, optional snapping to padding, and built-in right-to-left language support.
The project maintains a steady stream of commits addressing edge cases and user-reported issues. Pull requests receive thoughtful review with discussion of implementation trade-offs and compatibility concerns. The maintainer actively engages with users reporting problems, often providing diagnostic guidance and follow-up fixes. Documentation includes supplementary blog posts covering specific scenarios like nested RecyclerView scroll state preservation, indicating attention to real-world usage patterns beyond the basic README.