TextComponentSpec
@MountSpec(isPureRender = true, hasIntrinsicSize = true, poolSize = 30, canPreallocate = true, events = [TextOffsetOnTouchEvent::class] )
Component to render text. See text-widget for more details.
Example Text usage:
final SpannableStringBuilder spannable = new SpannableStringBuilder();
spannable.setSpan(new StyleSpan(Typeface.BOLD), start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
Text.create(c)
.text(spannable) // String can be used
.textSizeDip(20)
.maxLines(3)
.ellipsize(TextUtils.TruncateAt.END)
.textColor(Color.BLACK)
.build()Content copied to clipboard
Properties
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Functions
Link copied to clipboard
fun getExtraAccessibilityNodeAt(c: ComponentContext?, x: Int, y: Int, text: CharSequence?, textLayout: Layout, clickableSpans: Array<ClickableSpan?>): Int
Link copied to clipboard
fun getExtraAccessibilityNodesCount(c: ComponentContext?, accessibleClickableSpans: Boolean, clickableSpans: Array<ClickableSpan?>?): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun onBoundsDefined(c: ComponentContext, layout: ComponentLayout, text: CharSequence?, ellipsize: TextUtils.TruncateAt?, shouldIncludeFontPadding: Boolean, maxLines: Int, minEms: Int, maxEms: Int, minTextWidth: Int, maxTextWidth: Int, shadowRadius: Float, shadowDx: Float, shadowDy: Float, shadowColor: Int, isSingleLine: Boolean, textColor: Int, textColorStateList: ColorStateList?, linkColor: Int, textSize: Int, extraSpacing: Float, spacingMultiplier: Float, letterSpacing: Float, verticalGravity: VerticalGravity?, textStyle: Int, typeface: Typeface?, textAlignment: Layout.Alignment?, alignment: TextAlignment?, breakStrategy: Int, hyphenationFrequency: Int, glyphWarming: Boolean, textDirection: TextDirectionHeuristicCompat?, customEllipsisText: CharSequence?, lineHeight: Float, minimallyWide: Boolean, measureLayout: Layout?, measuredWidth: Int?, measuredHeight: Int?, fullWidth: Int?, processedText: Output<CharSequence?>, textLayout: Output<Layout?>, textLayoutTranslationX: Output<Float?>, textLayoutTranslationY: Output<Float?>, clickableSpans: Output<Array<ClickableSpan?>?>, imageSpans: Output<Array<ImageSpan?>?>, isExplicitlyTruncated: Output<Boolean>)
Link copied to clipboard
Link copied to clipboard
fun onLoadStyle(c: ComponentContext, ellipsize: Output<TextUtils.TruncateAt>?, extraSpacing: Output<Float>?, shouldIncludeFontPadding: Output<Boolean>?, spacingMultiplier: Output<Float>?, minLines: Output<Int>?, maxLines: Output<Int>?, minEms: Output<Int>?, maxEms: Output<Int>?, minTextWidth: Output<Int>?, maxTextWidth: Output<Int>?, isSingleLine: Output<Boolean>?, text: Output<CharSequence>?, textColorStateList: Output<ColorStateList>?, linkColor: Output<Int>?, highlightColor: Output<Int>?, textSize: Output<Int>?, alignment: Output<TextAlignment>?, breakStrategy: Output<Int>?, hyphenationFrequency: Output<Int>?, justificationMode: Output<Int>?, textStyle: Output<Int>?, shadowRadius: Output<Float>?, shadowDx: Output<Float>?, shadowDy: Output<Float>?, shadowColor: Output<Int>?, verticalGravity: Output<VerticalGravity>?, typeface: Output<Typeface>?)
Link copied to clipboard
fun onMeasure(context: ComponentContext, layout: ComponentLayout, widthSpec: Int, heightSpec: Int, size: Size, text: CharSequence?, ellipsize: TextUtils.TruncateAt?, shouldIncludeFontPadding: Boolean, minLines: Int, maxLines: Int, minEms: Int, maxEms: Int, minTextWidth: Int, maxTextWidth: Int, shadowRadius: Float, shadowDx: Float, shadowDy: Float, shadowColor: Int, isSingleLine: Boolean, textColor: Int, textColorStateList: ColorStateList?, linkColor: Int, textSize: Int, extraSpacing: Float, spacingMultiplier: Float, letterSpacing: Float, textStyle: Int, typeface: Typeface?, textAlignment: Layout.Alignment?, alignment: TextAlignment?, breakStrategy: Int, hyphenationFrequency: Int, justificationMode: Int, glyphWarming: Boolean, textDirection: TextDirectionHeuristicCompat?, minimallyWide: Boolean, minimallyWideThreshold: Int, lineHeight: Float, measureLayout: Output<Layout?>, measuredWidth: Output<Int?>, measuredHeight: Output<Int?>, fullWidth: Output<Int?>)
Link copied to clipboard
fun onMeasureIntrinsicHeight(c: ComponentContext, layout: ComponentLayout, widthSpec: Int, heightSpec: Int, text: CharSequence?, ellipsize: TextUtils.TruncateAt?, shouldIncludeFontPadding: Boolean, maxLines: Int, minEms: Int, maxEms: Int, minTextWidth: Int, maxTextWidth: Int, shadowRadius: Float, shadowDx: Float, shadowDy: Float, shadowColor: Int, isSingleLine: Boolean, textColor: Int, textColorStateList: ColorStateList?, linkColor: Int, textSize: Int, extraSpacing: Float, spacingMultiplier: Float, letterSpacing: Float, textStyle: Int, typeface: Typeface?, textAlignment: Layout.Alignment?, alignment: TextAlignment?, breakStrategy: Int, hyphenationFrequency: Int, justificationMode: Int, textDirection: TextDirectionHeuristicCompat?, lineHeight: Float): Int
Min-content height: the natural single-line height (measured unbounded).
Link copied to clipboard
fun onMeasureIntrinsicWidth(c: ComponentContext, layout: ComponentLayout, widthSpec: Int, heightSpec: Int, text: CharSequence?, ellipsize: TextUtils.TruncateAt?, shouldIncludeFontPadding: Boolean, maxLines: Int, minEms: Int, maxEms: Int, minTextWidth: Int, maxTextWidth: Int, shadowRadius: Float, shadowDx: Float, shadowDy: Float, shadowColor: Int, isSingleLine: Boolean, textColor: Int, textColorStateList: ColorStateList?, linkColor: Int, textSize: Int, extraSpacing: Float, spacingMultiplier: Float, letterSpacing: Float, textStyle: Int, typeface: Typeface?, textAlignment: Layout.Alignment?, alignment: TextAlignment?, breakStrategy: Int, hyphenationFrequency: Int, justificationMode: Int, textDirection: TextDirectionHeuristicCompat?, lineHeight: Float): Int
Min-content width: the longest-word width (measured unbounded).
Link copied to clipboard
fun onMount(c: ComponentContext, textDrawable: TextDrawable, text: CharSequence?, textColor: Int, highlightColor: Int, outlineWidth: Float, outlineColor: Int, textColorStateList: ColorStateList?, textOffsetOnTouchHandler: EventHandler<*>?, highlightStartOffset: Int, highlightEndOffset: Int, clickableSpanExpandedOffset: Float, clipToBounds: Boolean, spanListener: ClickableSpanListener?, touchableSpanListener: TouchableSpanListener?, processedText: CharSequence?, textLayout: Layout?, textLayoutTranslationX: Float?, textLayoutTranslationY: Float?, clickableSpans: Array<ClickableSpan?>?, imageSpans: Array<ImageSpan?>?, isExplicitlyTruncated: Boolean)
Link copied to clipboard
fun onPerformActionForVirtualView(c: ComponentContext?, host: View?, accessibilityNode: AccessibilityNodeInfoCompat?, virtualViewId: Int, action: Int, arguments: Bundle?, clickableSpans: Array<ClickableSpan>): Boolean
Link copied to clipboard
fun onPopulateAccessibilityNode(c: ComponentContext?, host: View?, node: AccessibilityNodeInfoCompat, text: CharSequence?, isSingleLine: Boolean)
Link copied to clipboard
fun onPopulateExtraAccessibilityNode(c: ComponentContext?, node: AccessibilityNodeInfoCompat, extraNodeIndex: Int, componentBoundsLeft: Int, componentBoundsTop: Int, text: CharSequence?, textLayout: Layout, clickableSpans: Array<ClickableSpan?>)
Link copied to clipboard
Link copied to clipboard
fun onVirtualViewKeyboardFocusChanged(c: ComponentContext?, host: View, accessibilityNode: AccessibilityNodeInfoCompat?, virtualViewId: Int, hasFocus: Boolean, clickableSpans: Array<ClickableSpan?>)
Link copied to clipboard
fun truncateText(text: CharSequence, customEllipsisText: CharSequence, newLayout: Layout, ellipsisTextLayout: Layout, ellipsizedLineNumber: Int, layoutWidth: Float, isAlignedLeft: Boolean, isRtl: Boolean): CharSequence
Truncates text which is too long and appends the given custom ellipsis CharSequence to the end of the visible text.