HarmonyOS progress组件线性样式设置渐变色不生效,是dp2版本API暂不支持吗

代码如下:

Progress({ value: 70, total: 100, type: ProgressType.Linear }) 
  .width(100) 
  .height(9) 
  .margin({ right: 16 }) 
  .color( new LinearGradient([{ color: "#65ed08f5", offset: 0 }, { color: "#65ef0849", offset: 1 }])) 
  .alignRules({ 
    'top': { anchor: "__container__", 'align': VerticalAlign.Top }, 
    'right': { anchor: "netWorkStateImage", 'align': HorizontalAlign.Start }, 
    'bottom': { anchor: "__container__", 'align': VerticalAlign.Bottom } 
  }) 
  .backgroundColor($r('app.color.rb_v1_timer_bg')) 
  .id('timeProgress')
HarmonyOS
2024-09-02 12:23:35
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
zbw_apple

LinearGradient设置Ring样式的渐变色,当前样式为Linear ,所以不生效。

参考文档:

https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-basic-components-progress-V5#属性

您本身代码并没有问题,渐变效果没有生效,是因为只有样式是Ring的时候,设置LinearGradient才有用。目前Linear仅支持单色显示。

分享
微博
QQ
微信
回复
2024-09-02 18:02:46
相关问题
Progress进度条如何实现渐变色
255浏览 • 1回复 待解决
组件如何实现渐变色
1814浏览 • 1回复 待解决
如何设置边框的颜色为渐变色
153浏览 • 1回复 待解决
Refresh组件不支持设置nestedScroll属性
1600浏览 • 1回复 待解决
Open Harmony 3.1版本支持横竖屏切换
4717浏览 • 1回复 待解决
鸿蒙NEXT版本,支不支持APK?
2294浏览 • 1回复 待解决
web组件不支持localstorage
498浏览 • 1回复 待解决
api9不支持三方包
2705浏览 • 1回复 待解决
mate30 5G鸿蒙110版本更新升级150版本
7222浏览 • 1回复 待解决
API 9 是否不支持 npm 了?
2409浏览 • 1回复 待解决
类似边框颜色线性渐变
417浏览 • 1回复 待解决
Lite Wearable 不支持 http 网络接口
3179浏览 • 1回复 待解决