ended3월 17일· 1 sources

Inline Gradient Chips in HarmonyOS: CustomSpan, Text Wrapper, and ImageSpan Approaches

HarmonyOS에서 인라인 그라디언트 칩 구현: CustomSpan, Text 래퍼, ImageSpan 접근법

Why it matters

In HarmonyOS, applying linearGradient directly to a Span is not supported because Span lacks universal attributes. Three workarounds are presented: (A) CustomSpan with drawing APIs to render a gradient rounded-rect background and foreground text, (B) wrapping the chip segment in a separate Text component that supports linearGradient, and (C) rendering the gradient and text onto a PixelMap and embedding it inline via ImageSpan/ImageAttachment.

1
Sources
+0
24h
Growth
177d
Active
HarmonyOSCustomSpanImageSpanGradient ChipsStyled Strings

Sources

Related Issues