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)
  }
}
  • 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.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
分享
微博
QQ
微信
回复
2025-01-09 19:46:32
相关问题
HarmonyOS 可以用仓颉开发HarmonyOS
938浏览 • 1回复 待解决
请问鸿蒙可以用什么控件开发短视频
7593浏览 • 1回复 待解决
HarmonyOS any类型什么替代
618浏览 • 1回复 待解决
HarmonyOS dataORM表字段可以用boolean
762浏览 • 1回复 待解决
360N6pro什么时候可以用鸿蒙系统?
8743浏览 • 1回复 待解决
安卓的onFftDataCapture什么替代?
5404浏览 • 1回复 待解决
可以用JS来开发鸿蒙应用吗?
376浏览 • 1回复 已解决
可以用Java来开发鸿蒙应用吗?
379浏览 • 2回复 已解决
HarmonyOS 有没有sha1加密库可以用
830浏览 • 1回复 待解决
可以用仓颉来开发鸿蒙应用吗?
347浏览 • 1回复 已解决
DevEco Studio 可以用 安卓手机调试吗?
5885浏览 • 1回复 待解决