HarmonyOS ViewOutlineProvider在HarmonyOS中可以用什么替代

ViewOutlineProvider在HarmonyOS中可以用什么替代。想绘制出来是一个组合的进度条,最终效果如图所示。

HarmonyOS ViewOutlineProvider在HarmonyOS中可以用什么替代 -鸿蒙开发者社区

HarmonyOS
2025-01-09 17:35:36
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
Excelsior_abit

示例参考如下:

interface Slide {
  width: string
  color: string
}

@Entry
@Component
struct Index {
  @State backColor: Slide[] = [
    {
      width: "30",
      color: "#ffdd1575"
    },
    {
      width: "20",
      color: "#ffa4ef0b"
    },
    {
      width: "50",
      color: "#ff11c4e2"
    }
  ]

  build() {
    Column() {
      Row() {
        ForEach(this.backColor, (item: Slide, index) => {
          Text()
            .width(item.width + '%')
            .height("100%")
            .backgroundColor(item.color)
            .borderRadius({
              bottomLeft: index === 0 ? 10 : "",
              topLeft: index === 0 ? 10 : "",
              topRight: index === (this.backColor.length - 1) ? 10 : "",
              bottomRight: index === (this.backColor.length - 1) ? 10 : ""
            })
        })
      }
      .width('100%')
      .height(100)
      .backgroundColor("#ffea0c0c")
      .borderRadius(10)
    }
    .padding(20)
  }
}
分享
微博
QQ
微信
回复
2025-01-09 19:46:32
相关问题
请问鸿蒙可以用什么控件开发短视频
7155浏览 • 1回复 待解决
HarmonyOS any类型什么替代
287浏览 • 1回复 待解决
HarmonyOS 可以用仓颉开发HarmonyOS
417浏览 • 1回复 待解决
HarmonyOS dataORM表字段可以用boolean
347浏览 • 1回复 待解决
360N6pro什么时候可以用鸿蒙系统?
8260浏览 • 1回复 待解决
安卓的onFftDataCapture什么替代?
4878浏览 • 1回复 待解决
HarmonyOS 有没有sha1加密库可以用
401浏览 • 1回复 待解决
DevEco Studio 可以用 安卓手机调试吗?
5174浏览 • 1回复 待解决
computeScroll() 方法鸿蒙有什么可以替代
6199浏览 • 1回复 待解决
可以用JS UI组件来做进度展示吗?
6123浏览 • 1回复 待解决