Interface IScrollableView
interface IScrollableView
Extends IView
The Scrollable interface defines the methods for scrollable components.
Scrollable components are those that can be scrolled either vertically or horizontally
to view content that exceeds the visible area.
Methods
setAxis()
Sets the scroll axis for the scrollable component. This method allows you to specify the scroll axis for the scrollable component. The scroll axis determines whether scrolling occurs vertically or horizontally.voidsetAxis(Axisaxis)
Parameters
axis
Axis — Required
The scroll axis to set.
See Axis
getAxis()
Axis getAxis()
Gets the current scroll axis of the scrollable component.
This method returns the current scroll axis of the scrollable component,
indicating whether scrolling occurs vertically or horizontally
Returns
Axis
The current scroll axis.
See Axis
setUnrestrictedScrollAllowed()
Allows or disallows unrestricted scrolling for the scrollable component. This method allows you to control whether unrestricted scrolling is allowed for the scrollable component. When unrestricted scrolling is allowed, the scrollable content can be scrolled beyond its boundaries. This behaviour is not allowed by default. Note that the upper bound for the position is still 0 (i.e. the scroll is still restricted on one end).voidsetUnrestrictedScrollAllowed(boolvalue)
Parameters
value
bool — Required
True to allow unrestricted scrolling, false to restrict scrolling within
the bounds of the content.
isUnrestrictedScrollAllowed()
bool isUnrestrictedScrollAllowed()
Checks if unrestricted scrolling is allowed for the scrollable component.
Returns
bool
True if unrestricted scrolling is allowed, false if scrolling is restricted
within the bounds of the content.
getScrollPosition()
float getScrollPosition()
The current scroll position of this scrollable.
It is the offset from the origin of this scrollable.
- A value of 0 indicates the initial state of the scrollable with unscrolled content.
- Positive values indicate general scrolling of the content.
- Negative values indicate overscroll past the start of the content. For example, when user drags past the view origin against the intended direction of scroll.
Returns
float
The current scroll position
setScrollListener()
Sets the scroll listener to receive notifications for scrolling events, such as scroll start and scroll end.com.amazon.apmf.ISubscription*setScrollListener(IScrollListener*scrollListener)
Parameters
scrollListener
IScrollListener* — Required
Pointer to an instance of IScrollListener.
Returns
com.amazon.apmf.ISubscription*
ISubscription object specific to the registered listener, which can be used for later removal.
Note: If this function is called multiple times, the previously set scroll lifecycle listener will be
unsubscribed and overridden. Subsequent calls with a different listener will replace the existing one,
and the new listener will be notified of scrolling events.
setMomentumScrollListener()
Sets the momentum scroll listener to receive notifications for scrolling events, such as momentumscroll start and scroll end.com.amazon.apmf.ISubscription*setMomentumScrollListener(IMomentumScrollListener*momentumScrollListener)
Parameters
momentumScrollListener
IMomentumScrollListener* — Required
Pointer to an instance of IMomentumScrollListener.
Returns
com.amazon.apmf.ISubscription*
ISubscription object specific to the registered listener, which can be used for later removal.
Note: If this function is called multiple times, the previously set scroll lifecycle listener will be
unsubscribed and overridden. Subsequent calls with a different listener will replace the existing one,
and the new listener will be notified of scrolling events.
setScrollFocusListener()
Sets the scroll focus listener to receive notifications for focus entering and exiting from scrollable view.com.amazon.apmf.ISubscription*setScrollFocusListener(IScrollFocusListener*scrollFocusListener)
Parameters
scrollFocusListener
IScrollFocusListener* — Required
Pointer to an instance of IScrollFocusListener.
Returns
com.amazon.apmf.ISubscription*
ISubscription object specific to the registered listener, which can be used for later removal.
Note: If this function is called multiple times, the previously set scroll lifecycle listener will be
unsubscribed and overridden. Subsequent calls with a different listener will replace the existing one,
and the new listener will be notified of scrolling events.
scrollTo()
Scrolls to the specified position without animation. The position is measured as the offset from the origin of the scrollable.boolscrollTo(floatscrollPosition)
- A value of 0 indicates the initial unscrolled position.
- Positive values indicate general scrolling of the content.
- Negative values indicate overscroll past the start of the content. For example, when user drags past the view origin against the intended direction of scroll.
Parameters
scrollPosition
float — Required
The target scroll position to scroll to
Returns
bool
true if the scroll position changed, false if the requested position
matched the current position or was unreachable due to bounds.
scrollToWithDefaultAnimation()
Scrolls to the specified position using default animation for smooth scrolling. The position is measured as the offset from the origin of the scrollable.boolscrollToWithDefaultAnimation(floatscrollPosition)
- A value of 0 indicates the initial unscrolled position.
- Positive values indicate general scrolling of the content.
- Negative values indicate overscroll past the start of the content. For example, when user drags past the view origin against the intended direction of scroll.
Parameters
scrollPosition
float — Required
The target scroll position to scroll to
Returns
bool
true if the scroll position changed, false if the requested position
matched the current position or was unreachable due to bounds.
setSnapConfig()
Sets thevoidsetSnapConfig(ISnapConfig*snapConfig)
ISnapConfig instance for managing snap related scrolling animations.
This method allows you to set a ISnapConfig instance that controls various
properties related to snap such as snap to Start, End or pagingEnabled.
Note: This function should be called whenever the content or state of the
ISnapConfig is modified to ensure that the animations stay in sync
with the component’s current state.
Parameters
snapConfig
ISnapConfig* — Required
An instance of ISnapConfig for managing scroll animations.
setFlingConfig()
Sets thevoidsetFlingConfig(IFlingConfig*flingConfig)
IFlingConfig instance for managing fling scrolling animations.
This method allows you to set a IFlingConfig instance that controls various
properties related to fling such as max duration and deceleration rate.
Note: This function should be called whenever the content or state of the
IFlingConfig is modified to ensure that the animations stay in sync
with the component’s current state.
Parameters
flingConfig
IFlingConfig* — Required
An instance of IFlingConfig for managing scroll animations.
disableFling()
void disableFling()
Disables fling scrolling behavior.
This method disables the fling scrolling behavior.
When fling scrolling is disabled, the view will not continue scrolling with inertia
after the user releases their touch or scroll gesture.
setBounces()
Set whether the scrollable bounces past the edge of content and back again. This sets a boolean value that controls the bouncing behavior of the scrollable when it reaches the boundary of the content. If set to true, the scrollable visually bounces at the content edge, indicating that scrolling has reached the limit. If set to false, scrolling stops immediately at the content boundary without bouncing. The default value is true.voidsetBounces(boolvalue)
Parameters
value
bool — Required
A boolean indicating whether edge bouncing is enabled (true) or disabled (false).
getTouchThreshold()
float getTouchThreshold()
Gets the current touch scroll threshold in device display pixels.
This method retrieves the current touch scroll threshold, which represents the minimum scroll
displacement required to trigger scrolling when dragging. The default threshold is 5 display pixels
on the screen.
Returns
float
The current scroll touch threshold as a floating-point value in device display pixels.
setTouchThreshold()
Sets the scroll touch/drag threshold in device display pixels. This method allows you to specify the scroll touch threshold, which represents the minimum scroll displacement required to trigger scrolling when dragging. You can set it in device display pixels.voidsetTouchThreshold(floatthreshold)
Parameters
threshold
float — Required
The scroll touch threshold as a floating-point value in device display pixels.
setFadingEdgeEnabled()
Sets whether fading edges are enabled when scrolling. This method allows you to enable or disable fading edges at the boundaries of the scrollable component when scrolling occurs. Fading edges provide a visual indication of the scrollable content’s boundaries. The default is false. When set to true, fading edges are shown at the boundaries where more content can be scrolled into view, using a default length of 50. The scrollable’s visible content is rendered into an offscreen buffer to apply the transparency fade, which increases GPU memory usage and rendering cost.voidsetFadingEdgeEnabled(boolfadingEdgeEnabled)
Parameters
fadingEdgeEnabled
bool — Required
True to enable fading edges, false to disable them.
isFadingEdgeEnabled()
bool isFadingEdgeEnabled()
Check whether the fading edge effect is enabled for this Scrollable.
Returns
bool
True if fading edge is enabled, false otherwise.
setFadingEdgeProperties()
Creates fading edges for the scrollable component. This method creates fading edges for the scrollable component, indicating the edges of the content area where scrolling is limited. You can specify the length and the color of the faded edge. Default: length of both edges is 50 if never set.voidsetFadingEdgeProperties(floatfadingEdgeLength,com.amazon.kepler.uitoolkit.graphics.Color*color)
Parameters
fadingEdgeLength
float — Required
The length of the faded edge as a floating-point value.
color
com.amazon.kepler.uitoolkit.graphics.Color* — Required
Color struct defining the color of the faded edge.
getContentWidth()
float getContentWidth()
Gets the width of the scroll content represented by the scrollable’s children.
This method calculates and returns the total width of the scroll content, taking into account
any blank spaces or extra offsets between children, if present.
Returns
float
The width of the scroll content as a floating-point value.
getContentHeight()
float getContentHeight()
Gets the height of the scroll content represented by the scrollable’s children.
This method calculates and returns the total height of the scroll content, taking into account
any blank spaces or extra offsets between children, if present.
Returns
float
The height of the scroll content as a floating-point value.

