HarmonyOS 如何给引用资源字符串中里某个内容单独加背景色?

资源库引入一个字符串资源,资源内容是:我的APP丨小程序丨线下门店可用,我想单独给:线下门店可用,加一个背景色,有什么方法吗?

阅读 527
1 个回答

可参考:

Text() {
  Span(this.applicableChannelStatus)
  if (this.offlineStoresAvailable) {
    ContainerSpan() {
      Span(this.offlineStoresAvailable)
        .fontColor($r('app.color.color_222427'))
        .lineHeight($r('app.float.size_15'))
    }.textBackgroundStyle({ color: $r('app.color.color_f0f2f4'), radius: $r('app.float.size_2') })
  }
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进