Stay organized with collections
Save and categorize content based on your preferences.
CarouselSnapHelper
public
class
CarouselSnapHelper
extends SnapHelper
java.lang.Object
|
↳ |
androidx.recyclerview.widget.RecyclerView.OnFlingListener
|
|
↳ |
androidx.recyclerview.widget.SnapHelper
|
|
|
↳ |
com.google.android.material.carousel.CarouselSnapHelper
|
Implementation of the SnapHelper
that supports snapping items to the carousel keylines
according to the strategy.
Summary
Inherited methods |
From class
androidx.recyclerview.widget.SnapHelper
void
|
attachToRecyclerView(RecyclerView arg0)
|
abstract
int[]
|
calculateDistanceToFinalSnap(RecyclerView.LayoutManager arg0, View arg1)
|
int[]
|
calculateScrollDistance(int arg0, int arg1)
|
RecyclerView.SmoothScroller
|
createScroller(RecyclerView.LayoutManager arg0)
|
LinearSmoothScroller
|
createSnapScroller(RecyclerView.LayoutManager arg0)
|
abstract
View
|
findSnapView(RecyclerView.LayoutManager arg0)
|
abstract
int
|
findTargetSnapPosition(RecyclerView.LayoutManager arg0, int arg1, int arg2)
|
boolean
|
onFling(int arg0, int arg1)
|
|
From class
androidx.recyclerview.widget.RecyclerView.OnFlingListener
abstract
boolean
|
onFling(int arg0, int arg1)
|
|
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
Public constructors
CarouselSnapHelper
public CarouselSnapHelper ()
CarouselSnapHelper
public CarouselSnapHelper (boolean disableFling)
Parameters |
disableFling |
boolean |
Public methods
public void attachToRecyclerView (RecyclerView recyclerView)
Parameters |
recyclerView |
RecyclerView |
public int[] calculateDistanceToFinalSnap (RecyclerView.LayoutManager layoutManager,
View view)
Parameters |
layoutManager |
RecyclerView.LayoutManager |
view |
View |
public View findSnapView (RecyclerView.LayoutManager layoutManager)
Parameters |
layoutManager |
RecyclerView.LayoutManager |
public int findTargetSnapPosition (RecyclerView.LayoutManager layoutManager,
int velocityX,
int velocityY)
Parameters |
layoutManager |
RecyclerView.LayoutManager |
velocityX |
int |
velocityY |
int |
Protected methods
protected RecyclerView.SmoothScroller createScroller (RecyclerView.LayoutManager layoutManager)
This is mostly a copy of SnapHelper#createSnapScroller
with a slight adjustment to
call ERROR(/CarouselSnapHelper#calculateDistanceToSnap(LayoutManager, View, boolean))
(LayoutManager, View)}. We want to do a partial snap since the correct target keyline state may
not have updated yet since this gets called before the keylines shift.
Parameters |
layoutManager |
RecyclerView.LayoutManager |
Returns |
RecyclerView.SmoothScroller |
|
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2023-10-09 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-09 UTC."],[],[]]