HarmonyOS Progress设置渐变无效

设置渐变效果无效,代码如下:

Progress({ value: this._mCurIndex + 1, total: this.datas.length, type: ProgressType.Linear })
  .backgroundColor($r('app.color.co_F0F4F5'))
  .color({
    angle: 0,
    colors: [["#f97794", 0.0], ["#623aa2", 1]]
  })
  .height(DimensionUtil.getVp(20)).layoutWeight(1)
HarmonyOS
2025-01-09 16:15:11
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
Heiang

目前progress只有ring类型进度条支持渐变色,其他类型暂不支持。可以自定义组件,参考代码如下:

Stack({ alignContent: Alignment.TopStart }) {
  Row() {
  }
  .backgroundColor('#F0F4F5')
  .width(200) //this.datas.length
  .borderRadius(5)
  .height(10)

  Row() {
  }
  .borderRadius(5)
  .height(10)
  .width(170) //this._mCurIndex+1
  .linearGradient({
    angle: 90,
    colors: [[0xf97794, 0.0], [0x623aa2, 1.0]]
  })
}
分享
微博
QQ
微信
回复
2025-01-09 19:47:38
相关问题
Progress进度条如何实现渐变色?
1366浏览 • 1回复 待解决
HarmonyOS designWidth设置无效
195浏览 • 1回复 待解决
HarmonyOS 设置 bodercolor 无效
505浏览 • 1回复 待解决
HarmonyOS 设置margin无效
140浏览 • 1回复 待解决
HarmonyOS bindPopup设置color无效
1255浏览 • 0回复 待解决
Rect设置渐变显示异常
627浏览 • 0回复 待解决
HarmonyOS 组件设置属性无效
776浏览 • 1回复 待解决
HarmonyOS camera设置对焦无效
776浏览 • 1回复 待解决
Text怎么设置文本渐变
740浏览 • 0回复 待解决
HarmonyOS 如何设置渐变背景色?
1529浏览 • 1回复 待解决
HarmonyOS 背景半透明渐变怎么设置
378浏览 • 1回复 待解决
HarmonyOS 用域名设置cookie无效
511浏览 • 1回复 待解决
HarmonyOS 怎么设置带圆角的渐变边框
403浏览 • 1回复 待解决
HarmonyOS Canvas设置渐变色没有效果
444浏览 • 1回复 待解决
HarmonyOS 相机打开闪光灯设置无效
1507浏览 • 1回复 待解决