BlazeWidgetItemSubtitleStyle - Android
The BlazeWidgetItemSubtitleStyle class defines the subtitle line of a Moments widget item: whether it shows, the spacing above it, and its text styles for the unread and read states. The line shows the moment's subtitle from its metadata.
Properties
isVisible: Boolean,
topSpacing: BlazeDp,
unreadState: BlazeWidgetItemTextStyle,
readState: BlazeWidgetItemTextStyleisVisible
Indicates whether the subtitle is visible. Defaults to false on all presets.
topSpacing
The spacing above the subtitle, separating it from the title. Only applies below a visible line. If the title is hidden, the subtitle starts at the top of the block.
unreadState
The subtitle text style for unread items.
readState
The subtitle text style for read items.
How it's laid out
- The title, subtitle, and description form one text block, always in that order. The block is placed with the title's
positionandmargins(see BlazeWidgetItemTitleStyle), even when the title itself is hidden. The subtitle has no position or horizontal margins of its own. - A visible subtitle with no text for an item takes no space, and the description moves up.
- Only Moments widgets show a subtitle. On Stories and Videos widgets,
isVisiblehas no effect. - Basic formatting in the text, such as bold and italic, is kept. Links are shown as plain text.
Default values
The Moments presets use these values for both unreadState and readState:
| Property | Default |
|---|---|
| isVisible | false |
| topSpacing | 2.blazeDp |
| textSize | 11f |
| textColor | #BABABA |
| fontResId | null (system font) |
| maxLines | 1 |
| gravity | Gravity.START |
Example
val layout = BlazeWidgetLayout.Presets.MomentsWidget.Row.verticalRectangles
layout.widgetItemStyle.subtitle.isVisible = true
layout.widgetItemStyle.subtitle.topSpacing = 4.blazeDp
layout.widgetItemStyle.subtitle.unreadState.textColor = Color.LTGRAY
layout.widgetItemStyle.subtitle.readState.textColor = Color.GRAYUpdated 14 days ago
Did this page help you?
