Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Native
Skip to main content

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()

void setAxis(Axis axis)
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.

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()

void setUnrestrictedScrollAllowed(bool value)
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).

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()

com.amazon.apmf.ISubscription* setScrollListener(IScrollListener* scrollListener)
Sets the scroll listener to receive notifications for scrolling events, such as scroll start and scroll end.

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()

com.amazon.apmf.ISubscription* setMomentumScrollListener(IMomentumScrollListener* momentumScrollListener)
Sets the momentum scroll listener to receive notifications for scrolling events, such as momentumscroll start and scroll end.

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()

com.amazon.apmf.ISubscription* setScrollFocusListener(IScrollFocusListener* scrollFocusListener)
Sets the scroll focus listener to receive notifications for focus entering and exiting from scrollable view.

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()

bool scrollTo(float scrollPosition)
Scrolls to the specified position without animation. The position is measured as the offset from the origin of the scrollable.
  • 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.
If the requested position is beyond the content bounds, it is clamped to the nearest valid scroll position.

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()

bool scrollToWithDefaultAnimation(float scrollPosition)
Scrolls to the specified position using default animation for smooth scrolling. The position is measured as the offset from the origin of the scrollable.
  • 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.
Scrollable transition will animate if smooth scrolling is enabled If the requested position is beyond the content bounds, it is clamped to the nearest valid scroll position.

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()

void setSnapConfig(ISnapConfig* snapConfig)
Sets the 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()

void setFlingConfig(IFlingConfig* flingConfig)
Sets the 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()

void setBounces(bool value)
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.

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()

void setTouchThreshold(float threshold)
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.

Parameters

threshold
float — Required The scroll touch threshold as a floating-point value in device display pixels.

setFadingEdgeEnabled()

void setFadingEdgeEnabled(bool fadingEdgeEnabled)
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.

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()

void setFadingEdgeProperties(float fadingEdgeLength, com.amazon.kepler.uitoolkit.graphics.Color* color)
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.

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.
Last modified on October 29, 2026