Interface ISnapConfigBuilder
interface ISnapConfigBuilder
Extends com.amazon.apmf.IStandard
The interface for building Snap configuration objects.
This interface defines methods for setting various configuration parameters
for Snap animations and building a corresponding Snap configuration object.
Methods
snapToInterval()
Set the snapping interval. When set, the snapping interval causes the Scrollable to stop at multiples of the value of snapToInterval during touch scrolling. This can be used for paginating through children that have lengths smaller than the scrollable. Typically, this is used in combination with snapToAlignment.voidsnapToInterval(floatinterval)
Parameters
interval
float — Required
The snapping interval to set. Value = 0.0f disables interval snapping,
while any other non-zero value enables interval snapping.
snapToAlignment()
Set the alignment of snap points within this Scrollable. Use this method to specify where snaps will stop in relation to this Scrollable. The alignment determines whether snaps will align with the start, center, or end of the Scrollable.voidsnapToAlignment(ScrollSnapAlignmentalignment)
Parameters
alignment
ScrollSnapAlignment — Required
The ScrollSnapAlignment enum value specifying the snap alignment.
Default is ScrollSnapAlignment::Start
snapToStart()
Enable or disable snapping to the start position during scrolling animations. Use this method to enable or disable snapping to the start position. By default, the beginning of the list counts as a snap offset. SettingvoidsnapToStart(boolsnapToStart)
snapToStart to false
allows the list to scroll freely between its start and the first snapToOffsets offset.
Parameters
snapToStart
bool — Required
Set to true to enable snapping to the start position, or false to disable it.
snapToEnd()
Enable or disable snapping to the end position during scrolling animations. This method allows you to control whether scrolling animations should snap to the end position when the animation comes to a stop. When snapping to the end is enabled, the view will align with the end position once the animation finishes.voidsnapToEnd(boolsnapToEnd)
Parameters
snapToEnd
bool — Required
Set to true to enable snapping to the end position, or false to disable it.
Note: By default, the end of the list counts as a snap offset. Setting snapToEnd to
false allows the list to scroll freely between its end and the last snapToOffsets offset.
snapToOffsets()
Set an array of predefined offsets for snapping during scrolling animations. This method allows you to specify an array of predefined offsets to which scrolling animations can snap when they come to a stop. Enabling snapping viavoidsnapToOffsets(float[]snapToOffsets)
setSnapToOffsets
and providing these offsets ensures that the view aligns with one of these positions
when the animation ends.
Parameters
snapToOffsets
float[] — Required
An array of float values representing predefined snap offsets.
Note: When set, these predefined offsets cause the scrollable to stop at these defined positions.
This can be used for paginating through variously sized children that have lengths smaller than
the scrollable. It’s typically used in combination with a fast deceleration rate and
overrides less configurable properties like pagingEnabled and snapToInterval.
pagingEnabled()
Enable or disable paging behavior for scrolling animations. Paging behavior is often used in scrollable views to align the content to discrete pages or items. When paging is enabled, scrolling animations will snap to the nearest page boundary, providing a smooth and predictable user experience.voidpagingEnabled(boolpagingEnabled)
Parameters
pagingEnabled
bool — Required
Set to true to enable paging behavior, or false to disable it.
build()
This method creates the instance of ISnapConfigISnapConfig*build()
Returns
ISnapConfig*
The new ISnapConfig instance.

