HarmonyOS 文字展示中包含网络图片混合展示,需要怎展示这个Title

HarmonyOS
2024-12-26 15:16:21
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
zbw_apple

可以参考ImageSpan组件:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-basic-components-imagespan-V5#示例

参考demo:

// xxx.ets
@Entry
@Component
struct SpanExample {
  build() {
    Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
      Text() {
        Span('This is the Span and ImageSpan component').fontSize(25).textCase(TextCase.Normal)
          .decoration({ type: TextDecorationType.None, color: Color.Pink })
      }.width('100%').textAlign(TextAlign.Center)
      Text() {
        ImageSpan($r('app.media.icon'))
          .width('200px')
          .height('200px')
          .objectFit(ImageFit.Fill)
          .verticalAlign(ImageSpanAlignment.CENTER)
        Span('I am LineThrough-span')
          .decoration({ type: TextDecorationType.LineThrough, color: Color.Red }).fontSize(25)
        ImageSpan($r('app.media.icon'))
          .width('50px')
          .height('50px')
          .verticalAlign(ImageSpanAlignment.TOP)
        Span('I am Underline-span')
          .decoration({ type: TextDecorationType.Underline, color: Color.Red }).fontSize(25)
        ImageSpan($r('app.media.icon'))
          .size({ width: '100px', height: '100px' })
          .verticalAlign(ImageSpanAlignment.BASELINE)
        Span('I am Underline-span')
          .decoration({ type: TextDecorationType.Underline, color: Color.Red }).fontSize(25)
        ImageSpan($r('app.media.icon'))
          .width('70px')
          .height('70px')
          .verticalAlign(ImageSpanAlignment.BOTTOM)
        Span('I am Underline-span')
          .decoration({ type: TextDecorationType.Underline, color: Color.Red }).fontSize(50)
      }
      .width('100%')
      .textIndent(50)
    }.width('100%').height('100%').padding({ left: 0, right: 0, top: 0 })
  }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
分享
微博
QQ
微信
回复
2024-12-26 17:00:21
相关问题
HarmonyOS RichText展示的内容文字都很小
509浏览 • 1回复 待解决
HarmonyOS Image展示本地图片失败
1211浏览 • 1回复 待解决
HarmonyOS 地图无法展示
830浏览 • 1回复 待解决
HarmonyOS 动画展示
432浏览 • 1回复 待解决
HarmonyOS map无法展示
698浏览 • 1回复 待解决
HarmonyOS RichText 展示问题
660浏览 • 1回复 待解决
HarmonyOS 地图不展示
684浏览 • 1回复 待解决
HarmonyOS 业务图表展示
713浏览 • 1回复 待解决
HarmonyOS Toast无法展示
597浏览 • 1回复 待解决
富文本在web组件无法展示
2923浏览 • 1回复 待解决
HarmonyOS H5展示沙箱路径里面的图片
976浏览 • 1回复 待解决