Row里面的子内容长度超过Row后,循环平移,内容既有图片也有文字,没法用Marquee组件来实现,有什么方案?

一个组件,比如Row里面的子内容长度超过Row后,循环平移(类似跑马灯效果),内容既有图片也有文字,没法用Marquee组件来实现,有什么实现方案?


HarmonyOS
2024-10-28 10:23:13
808浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
zxjiu

可参考:

@Entry  
@Component  
struct Page_7054 {  
  
  build() {  
    Row() {  
      Text(){  
        Span('This is the Span component')  
          .fontSize(12)  
          .textCase(TextCase.Normal)  
          .decoration({ type: TextDecorationType.None, color: Color.Red })  
        ImageSpan($r('app.media.app_icon'))  
          .width(40)  
          .height(40)  
        Span('Life is too short to spend time with people who suck the happiness out of you. ' +  
          'If someone wants you in their life, they’ll make room for you. You shouldn’t have to fight for a spot. ')  
          .fontSize(12)  
          .textCase(TextCase.Normal)  
          .decoration({ type: TextDecorationType.None, color: Color.Red })  
      }  
      .textOverflow({ overflow: TextOverflow.MARQUEE })  
    }  
    .height('100%')  
    .width('100%')  
  }  
}
  • 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.
分享
微博
QQ
微信
回复
2024-10-28 15:12:42
相关问题
HarmonyOS row中的控件超出了row的范围
1272浏览 • 1回复 待解决
HarmonyOS 文字Row中不居中
732浏览 • 1回复 待解决
函数内容没法toast!!!
7925浏览 • 3回复 待解决
求助,docker 上的 centos 容器没法用 yum
3034浏览 • 1回复 待解决
鸿蒙NFC API没法用怎么回事啊?
3655浏览 • 1回复 待解决
HarmonyOS Row组件怎么居中
578浏览 • 1回复 待解决
日志里面的appfreeze文件要看哪些内容
2466浏览 • 1回复 待解决
napi返回ArrayBuffer长度但是内容都是0
1854浏览 • 1回复 待解决
HarmonyOS Row()为什么不能添加圆角
841浏览 • 1回复 待解决
循环显示包含图片组件
1249浏览 • 1回复 待解决
web组件未加载出url内容
1191浏览 • 1回复 待解决