ScrollView

EntityVisualQuadLayerViewceramic.ScrollView (Class) → CollectionView, elements.ScrollingLayout

A view that provides scrolling functionality for content that exceeds its bounds.

ScrollView wraps a Scroller component and manages a content view that can be larger than the scroll view itself. It supports both horizontal and vertical scrolling, with optional paging behavior.

Key features:

  • Horizontal or vertical scrolling
  • Optional paging with configurable page size and spacing
  • Momentum-based scrolling with customizable thresholds
  • Automatic content size management
var scrollView = new ScrollView();
scrollView.viewSize(300, 400);
scrollView.contentSize = 800; // Content is taller than view
scrollView.direction = VERTICAL;

// Add content to the contentView
var content = new View();
content.viewSize(300, 800);
content.size(300, 800);
scrollView.contentView.add(content);
See: Scroller The underlying scrolling component, PagerView For page-based scrolling with view recycling

Instance Members

ui
scroller: Scroller

The underlying Scroller component that handles touch interaction and scroll physics. This is automatically created and managed.


ui
contentView: View

The view that contains the scrollable content. All scrollable items should be added as children to this view. The content view is automatically sized based on contentSize and direction.


ui
contentSize: Float

The size of the scrollable content in the scroll direction.

  • For VERTICAL scrolling: sets the height of contentView
  • For HORIZONTAL scrolling: sets the width of contentView Values less than 0 are clamped to 0. Default: -1 (uses view size)

ui
direction: Anonymous

The scroll direction (HORIZONTAL or VERTICAL). This determines which axis is scrollable.


ui
pagingEnabled: Bool

Enable paging of the scroller so that everytime we stop dragging, it snaps to the closest page. When enabled, the scroll view will snap to page boundaries defined by pageSize. Default: false


ui
pageSize: Float

When pagingEnabled is true, this is the size of a page. If kept to -1 (default), it will use the scroller size.

  • For VERTICAL: page height
  • For HORIZONTAL: page width Default: -1 (uses view dimensions)

ui
pageSpacing: Float

When pagingEnabled is true, this is the spacing between each page. This adds extra space between pages that is not part of the page content. Default: 0


ui
pageMomentumThreshold: Float

When pagingEnabled is true, this threshold value will be used to move to a sibling page if the momentum is equal or above it. Lower values make it easier to flip between pages with small gestures. If kept to -1 (default), it will use the page size. Default: -1


ui
new(): Void

Create a new ScrollView. Automatically initializes the content view and scroller components.

Private Members

ui
initContentView(): Void

Initialize the content view that will hold scrollable content. Sets up the parent-child relationship for proper event handling.


ui
initScroller(): Void

Initialize the scroller component with the content view. The scroller handles all touch interaction and scrolling physics.


ui
layout(): Void

Layout the scroll view components.

  • Positions the scroller to fill the entire view
  • Sizes the content view based on direction and contentSize
  • Ensures content is at least as large as the view itself

Metadata

Name Parameters
:build ceramic.macros.EntityMacro.buildForCompletion()
:autoBuild ceramic.macros.EntityMacro.buildForCompletion()
:build tracker.macros.EventsMacro.build()
:autoBuild tracker.macros.EventsMacro.build()