For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

Properties

feedLayout

Type: FeedLayout (enum) Default: FeedLayout.HORIZONTAL

Determines the layout type for displaying videos.

Values:

  • HORIZONTAL - Horizontal scrolling row

  • VERTICAL - Vertical scrolling column

  • GRID - 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:

Parameter
Type
Description

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: 4dp

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.

showShoppingBagIcon

Type: Boolean Default: false

Show or hide the shopping bag icon overlay on video thumbnails. When enabled and the video has associated products, a small shopping bag icon is displayed on the thumbnail to indicate shoppable content.

Behavior:

  • true - A shopping bag icon is shown on thumbnails of videos that have associated products

  • false - No shopping bag icon is displayed on thumbnails

Note: This only affects the feed thumbnail view. The shopping bag icon is not shown on videos without associated products regardless of this setting.

shoppingBagIcon

Type: ShoppingBagIcon (sealed class) Default: ShoppingBagIcon.Default Customize the shopping bag icon appearance. Requires showShoppingBagIcon to be true.

Data Structure

WidgetImage

WidgetImage is the SDK's standard wrapper for a drawable resource with an optional tint:

Parameter
Type
Nullable
Description

drawableRes

Int (@DrawableRes)

No

A valid Android drawable resource ID (e.g. R.drawable.my_icon).

tintColor

Int? (@ColorInt)

Yes

A color int to tint the drawable. Pass null to keep the drawable's original colors.

CustomIcon.size

Parameter
Type
Nullable
Description

size

Pair<Int, Int>?

Yes

Width (first) and height (second) in pixels. If null, the icon retains the default proportional sizing based on the thumbnail.

Usage Examples

feedTitlePosition

Type: FeedTitlePosition (enum) Default: FeedTitlePosition.NESTED

Position of the feed title relative to video thumbnails.

Values:

  • NESTED - Title overlays the thumbnail

  • STACKED - 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

Format Requirements - The SDK currently supports JPG format images only.

The SDK selects thumbnails according to the following priority:

  1. The system will automatically extract a frame from the video and generate a default thumbnail matching the video's aspect ratio

  2. When only a Vertical Image Poster or Horizontal Image Poster is uploaded The system will use the uploaded poster as the thumbnail

  3. 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

Property
Default Value

feedLayout

HORIZONTAL

columnCount

2

backgroundColor

Transparent

feedPadding

null

itemSpacing

0

roundedCorner

false

roundedCornerRadius

5 (when enabled)

showPlayIcon

true

playIconWidth

24dp

showShoppingBagIcon

false

shoppingBagIcon

ShoppingBagIcon.Default

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

Important Notes

  • columnCount only affects grid layouts

  • roundedCornerRadius only applies when roundedCorner is true

  • Item spacing is in pixels - use dpToPx() for density-independent values

  • Aspect ratio can be calculated as width.0 / height.0

  • Background color affects the feed container, not individual thumbnails

  • Layout changes require re-initializing the feed view

See Also

Last updated

Was this helpful?