Layout Options
LayoutOption controls the visual layout and appearance of FwVideoFeedView widget. It determines how video thumbnails are arranged, spaced, and styled.
Overview
LayoutOption provides comprehensive control over the feed's visual presentation, including:
Layout type (grid, horizontal, vertical)
Column count for grid layouts
Spacing between items
Thumbnail appearance (rounded corners, play icon)
Feed title positioning
Background colors
Creating LayoutOption
Using Builder
val layoutOption = LayoutOption.Builder()
.feedLayout(FeedLayout.GRID)
.columnCount(3)
.itemSpacing(8)
.roundedCorner(true)
.build()Using DSL (Recommended)
Properties
feedLayout
Type: FeedLayout (enum)
Default: FeedLayout.HORIZONTAL
Determines the layout type for displaying videos.
Values:
HORIZONTAL- Horizontal scrolling rowVERTICAL- Vertical scrolling columnGRID- Multi-column grid
columnCount
Type: Int
Default: 2
Applies to: Grid layout only
Number of columns in grid layout.
Note: This property only affects grid layouts. It's ignored for horizontal and vertical layouts.
backgroundColor
Type: Int (color)
Default: Transparent
Background color for the feed container.
feedPadding
Type: FeedPadding (data class)
Default: null
Sets the padding around the feed container. This controls the spacing between the feed content and its container edges.
FeedPadding Parameters:
start
Int
Start padding in pixels (left in LTR, right in RTL)
top
Int
Top padding in pixels
end
Int
End padding in pixels (right in LTR, left in RTL)
bottom
Int
Bottom padding in pixels
Tip: Use dpToPx() extension for density-independent values:
Use Cases:
Add horizontal margins to prevent content from touching screen edges
Create vertical spacing between feed and other UI elements
Support RTL layouts with start/end instead of left/right
Note: Unlike itemSpacing which controls spacing between items, feedPadding controls the outer padding of the entire feed container.
itemSpacing
Type: Int (pixels)
Default: 0
Spacing between feed items in pixels.
Tip: Use dpToPx() extension for dp values:
roundedCorner
Type: Boolean
Default: false
Enable or disable rounded corners on video thumbnails.
roundedCornerRadius
Type: Int (pixels)
Default: 5 (when roundedCorner is true)
Corner radius for rounded thumbnails in pixels.
Note: Only applies when roundedCorner is true.
showPlayIcon
Type: Boolean
Default: true
Show or hide the play icon overlay on video thumbnails.
playIconWidth
Type: Int (pixels)
Default: 24dp (converted to pixels)
Width of the play icon on video thumbnails.
feedTitlePosition
Type: FeedTitlePosition (enum)
Default: FeedTitlePosition.NESTED
Position of the feed title relative to video thumbnails.
Values:
NESTED- Title overlays the thumbnailSTACKED- Title appears below the thumbnail
aspectRatio
Type: Double
Default: 9:16
Custom aspect ratio for video items.
Note: If not specified, the SDK uses the 9:16 aspect ratio.
Thumbnail Selection Rules
The SDK selects thumbnails according to the following priority:
The system will automatically extract a frame from the video and generate a default thumbnail matching the video's aspect ratio
When only a Vertical Image Poster or Horizontal Image Poster is uploaded The system will use the uploaded poster as the thumbnail
When both Vertical and Horizontal Image Posters are uploaded The Carousel component will automatically select the poster image that most closely matches its Item's aspect ratio as the thumbnail
Default Values
feedLayout
HORIZONTAL
columnCount
2
backgroundColor
Transparent
feedPadding
null
itemSpacing
0
roundedCorner
false
roundedCornerRadius
5 (when enabled)
showPlayIcon
true
playIconWidth
24dp
feedTitlePosition
NESTED
aspectRatio
9:16
Layout Type Examples
Horizontal Layout
Displays videos in a single horizontal scrolling row.
Vertical Layout
Displays videos in a single vertical scrolling column.
Grid Layout
Displays videos in a multi-column grid.
Complete Examples
Modern Grid Feed
Horizontal Story Feed
Product Gallery Grid
Important Notes
columnCountonly affects grid layoutsroundedCornerRadiusonly applies whenroundedCorneristrueItem spacing is in pixels - use
dpToPx()for density-independent valuesAspect ratio can be calculated as
width.0 / height.0Background color affects the feed container, not individual thumbnails
Layout changes require re-initializing the feed view
See Also
ViewOptions Overview - Complete configuration system
BaseOption - Content source configuration
FwVideoFeedView - Video feed widget
TitleOption - Feed title styling
Last updated
Was this helpful?