Title Options

TitleOption controls the appearance and visibility of feed titles in FwVideoFeedView widget. It provides comprehensive styling options for title text, background, and layout.

Overview

TitleOption allows you to customize:

  • Title visibility

  • Text color, size, and typeface

  • Background color and styling

  • Text padding and line count

  • Title positioning (via LayoutOption)

Creating TitleOption

Using Builder

val titleOption = TitleOption.Builder()
    .showFeedTitle(true)
    .feedTitleTextColor(Color.BLACK)
    .feedTitleBackgroundColor(Color.WHITE)
    .feedTitleTextSize(18)
    .build()

Properties

showFeedTitle

Type: Boolean Default: true

Show or hide the feed title.

feedTitleTextColor

Type: Int (color) Default: White (0xFFFFFFFF)

Text color for the feed title.

feedTitleBackgroundColor

Type: Int (color) Default: Semi-transparent black (0x80000000)

Background color for the feed title.

feedTitleBackgroundDrawable

Type: GradientDrawable Default: Semi-transparent black gradient

Custom background drawable for the feed title.

Note: This overrides feedTitleBackgroundColor when set.

feedTitleTextSize

Type: Int (pixels) Default: SDK default

Text size for the feed title in pixels.

Tip: Use spToPx() to convert sp (scale-independent pixels) to pixels for consistent text sizing.

feedTitleTextNumberOfLines

Type: Int Default: 2

Maximum number of lines for the feed title.

feedTitleTextPadding

Type: Int (pixels) Default: SDK default

Padding around the feed title text in pixels.

feedTitleTextTypeface

Type: Typeface Default: Typeface.DEFAULT

Custom typeface for the feed title.

Default Values

Property
Default Value

showFeedTitle

true

feedTitleTextColor

White (0xFFFFFFFF)

feedTitleBackgroundColor

Semi-transparent black (0x80000000)

feedTitleTextNumberOfLines

2

feedTitleTextTypeface

Typeface.DEFAULT

Complete Examples

Simple Title Configuration

Styled Title with Custom Font

Gradient Background Title

Title Positioning

Title position is controlled by LayoutOption.feedTitlePosition:

Nested Position

Title overlays the video thumbnail:

Stacked Position

Title appears below the video thumbnail:

Important Notes

  • feedTitleBackgroundDrawable overrides feedTitleBackgroundColor when both are set

  • Text size should use sp units for accessibility - convert using spToPx()

  • Padding uses dp units - convert using dpToPx()

  • Title visibility is also affected by showFeedTitle setting

  • Title position is configured in LayoutOption, not TitleOption

  • Custom typefaces must be included in your app's resources

  • Use Color.TRANSPARENT to remove background entirely

  • Number of lines set to 1 will truncate long titles with ellipsis

See Also

Last updated

Was this helpful?