Skip to content

Layout & Rendering

VirtualViewList supports multiple layout types and granular control over spacing and render direction.

Layout Modes

EnumDescriptionUse cases
ViewLayoutType.VERTICALStandard vertical list.Chat, ranking, feed.
ViewLayoutType.HORIZONTALHorizontal list.Carousels, level selection.
ViewLayoutType.GRIDGrid layout with vertical or horizontal main axis.Item grids, card collections.

Grid Direction

  • scrollDirection = VERTICAL
    • cols defines columns.
    • girdVertRowsSpacing / girdVertColsSpacing control row/column gaps.
  • scrollDirection = HORIZONTAL
    • rows defines rows.
    • girdHoriRowsSpacing / girdHoriColsSpacing control gaps.

Render Direction

  • verticalRenderDirection
    • TOP_TO_BOTTOM: top anchored (default).
    • BOTTOM_TO_TOP: bottom anchored (useful for chat histories).
  • horizontalRenderDirection
    • LEFT_TO_RIGHT
    • RIGHT_TO_LEFT

Spacing & Padding

  • itemSpacing: gap between items in list mode.
  • paddingTop/Bottom/Left/Right: inner padding for the content node.
  • Grid layouts use the dedicated spacing properties listed above.

Call ReloadData() or Refresh() after updating spacing-related values.

Dynamic Sizes

  • In list mode you can call UpdateItemSize(index, size) to adjust height/width on the fly.
  • For precomputed sizes, pass an array via ReloadData's customSize parameter.

Visibility & Buffering

  • cacheRatio controls how many extra items to render outside the viewport.
  • PreloadItems(count) can prepare nodes ahead of time to reduce first-scroll spikes.

Continue with Performance Tuning for detailed optimisation tips.