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 IPagerView

interface IPagerView
Extends IView3 IPagerView is a container view that enables swipe-based navigation between multiple child views (pages). This interface provides a paginated view system similar to ViewPager in Android or UIPageViewController in iOS, allowing users to navigate through a collection of views by swiping horizontally or vertically. Each child view represents a distinct page that occupies the full visible area of the PagerView. Page Management: Pages are added as child views. The PagerView automatically handles the layout and positioning of these child views based on the current axis and user interactions. Performance Considerations: The PagerView implements virtualization through the offscreen page limit, keeping only a subset of pages in memory while unloading distant pages to optimize memory usage. This is particularly important for large datasets or memory-constrained environments. Implements IView3, implements all standard view capabilities including layout, styling, and child management

Methods

setAxis()

void setAxis(Axis axis)
Sets the scrolling axis of the PagerView to control the direction of page navigation. This method configures whether pages are arranged and navigated horizontally or vertically. The axis affects how user gestures are interpreted and how pages are laid out within the PagerView container. When set to Axis::HORIZONTAL, pages are arranged side-by-side and users swipe left/right to navigate. When set to Axis::VERTICAL, pages are stacked vertically and users swipe up/down to navigate. Default value of PagerView axis is Axis::HORIZONTAL

Parameters

axis
Axis — Required The Axis for page navigation.

getAxis()

Axis getAxis()
Gets the scrolling axis of the PagerView.

Returns

Axis the axis of the PagerView.

setCurrentPage()

void setCurrentPage(u32 pageIndex, bool smoothScroll)
Programmatically navigates to the specified page with optional smooth scrolling animation. This method allows programmatic navigation to any valid page within the PagerView. The page transition can be either immediate (jump) or animated (smooth scroll) based on the smoothScroll parameter. If the specified pageIndex is out of bounds, the method will clamp to the nearest valid page. When smoothScroll is true, the transition uses the default animation duration and easing curve. When false, the page change is immediate without any visual transition. Default PagerView instantiates with pageIndex 0 as the initial page.

Parameters

pageIndex
u32 — Required The zero-based index of the target page to navigate to.
smoothScroll
bool — Required Whether to animate the transition (true) or jump immediately (false).

getCurrentPageIndex()

u32 getCurrentPageIndex()
Gets the current page index.

Returns

u32 the index of the current page.

getPageCount()

u32 getPageCount()
Gets the total number of pages in the PagerView.

Returns

u32 the total number of pages.

setPageMargin()

void setPageMargin(u32 margin)
Sets the spacing between adjacent pages. This method controls the visual gap between consecutive pages in the PagerView. The margin creates empty space that separates pages, allowing users to see portions of adjacent pages during transitions or when pages are partially visible. A positive margin size creates space between pages, while a value of 0 makes pages touch each other. The margin is applied consistently between all adjacent pages in the PagerView. Default page margin value is 0

Parameters

margin
u32 — Required The spacing between pages.

getPageMargin()

u32 getPageMargin()
Gets the page margin.

Returns

u32 the margin size between pages.

setOverscrollMode()

void setOverscrollMode(OverscrollMode mode)
Sets the overscroll mode. Default overscroll mode is OverscrollMode::AUTO

Parameters

mode
OverscrollMode — Required the overscroll mode. See OverscrollMode.

getOverscrollMode()

OverscrollMode getOverscrollMode()
Gets the overscroll mode.

Returns

OverscrollMode the overscroll mode. See OverscrollMode.

setKeyboardDismissMode()

void setKeyboardDismissMode(KeyboardDismissMode mode)
Sets the keyboard dismiss mode. Default keyboard dismiss mode is KeyboardDismissMode::NONE Note: This feature is not applicable when fullscreen keyboard is visible.

Parameters

mode
KeyboardDismissMode — Required the keyboard dismiss mode. See KeyboardDismissMode.

getKeyboardDismissMode()

KeyboardDismissMode getKeyboardDismissMode()
Gets the keyboard dismiss mode.

Returns

KeyboardDismissMode the keyboard dismiss mode. See KeyboardDismissMode.

setOffscreenPageLimit()

void setOffscreenPageLimit(u32 limit)
Sets the number of pages that should be retained on either side of the currently visible page. This method controls the PagerView’s virtualization and memory management by determining how many pages are kept loaded and ready for display adjacent to the current page. Pages beyond this limit will be recreated from the adapter when needed. This setting is offered as an optimization to improve the smoothness and responsiveness of page navigation in your application. By adjusting the offscreen page limit value, you can control how many pages are kept active in memory at once, reducing the need to recreate layouts when navigating back and forth. If you know in advance the number of pages your app must support, or you already have lazy-loading in place, adjusting the page cache value can significantly improve perceived smoothness. With a small number of pages (such as 3–4) kept active, less time is spent creating new view subtrees as users navigate back and forth, resulting in a faster and more polished experience. Default value of offscreen page limit is 1 Note:
  • Keep this value low, especially for pages with complex layouts, to avoid excessive memory usage.
  • If 0 is passed, then no caching will be implemented and pages will be mounted/unmounted on every scroll.

Parameters

limit
u32 — Required The number of pages to retain on each side of the current page.

getOffscreenPageLimit()

u32 getOffscreenPageLimit()
Gets the offscreen page limit.

Returns

u32 the number of pages that are retained to either side of the current page.

setTouchScrollEnabled()

void setTouchScrollEnabled(bool enabled)
Enable or disable user initiated scrolling through touch based gestures. This method controls whether users can navigate between pages using touch based gestures. Programmatic navigations including the ones triggered by key events remain functional regardless of this setting. If it is disabled, {link @OverscrollMode} will have no effect. When enabled (true):
  • Users can swipe/drag to navigate between pages.
  • Touch based gestures including overscroll effects are interpreted and processed.
  • Scroll events and callbacks are triggered normally.
When disabled (false):
  • User swipe/drag gestures are ignored
  • Touch based scrolling is completely blocked including the overscroll effects
  • Only programmatic navigations including the ones triggered by key events work.
Default value is true

Parameters

enabled
bool — Required True to enable user touch based scrolling, false to disable it.

isTouchScrollEnabled()

bool isTouchScrollEnabled()
Gets whether the PagerView can be scrolled by user touch based gestures.

Returns

bool True if the PagerView can be scrolled by touch based gestures, false otherwise.

setLayoutDirection()

void setLayoutDirection(LayoutDirection direction)
Sets the layout direction for page arrangement and navigation. This method controls how pages are arranged and navigated along the axis. For Axis::HORIZONTAL axis: FORWARD implies pages flow from Left-to-Right (LTR) REVERSE implies pages flow from Right-to-Left (RTL) For Axis::VERTICAL axis: FORWARD implies pages flow from Top-to-Bottom (TTB) REVERSE implies pages flow from Bottom-to-Top (BTT) The default layout direction is FORWARD.

Parameters

direction
LayoutDirection — Required The layout direction to set

getLayoutDirection()

LayoutDirection getLayoutDirection()
The current layout direction for this PagerView.

Returns

LayoutDirection The current layout direction

addPagerViewListener()

com.amazon.apmf.ISubscription* addPagerViewListener(IPagerViewListener* listener)
Adds a listener for PagerView events to respond to user interactions and page changes. The listener receives callbacks for page selection, scroll state changes, and continuous scroll position updates.

Parameters

listener
IPagerViewListener* — Required The IPagerViewListener instance to receive event callbacks.

Returns

com.amazon.apmf.ISubscription* ISubscription object that can be used to unsubscribe the listener.
Last modified on October 29, 2026