【鸿蒙学习笔记】ArkTS组件・基础组件・Progress・进度条组件

官方文档:Progress

Progress:进度条组件

进度赋值

Progress({ value: 20			, type: ProgressType.Linear }) 			 	// 默认总数为100,20%
Progress({ value: 40, total: 200, type: ProgressType.Linear }) 				// 指定总数,20%
Progress({ value: 20, total: 100, type: ProgressType.Linear }).value(50)    // 进度可更新,20% → 50%

风格样式

@Entry
@Component
struct Progress_page {
  @State message: string = 'Hello World';

  build() {
    Column({ space: 15 }) {
      Text('Linear ').fontSize(15).fontColor(Color.Black).width('90%')
      Progress({ value: 20, type: ProgressType.Linear }).width(100)

      Text('Eclipse ').fontSize(15).fontColor(Color.Black).width('90%')
      Row({ space: 40 }) {
        Progress({ value: 10, type: ProgressType.Eclipse }).width(100)
      }

      Text('ScaleRing ').fontSize(15).fontColor(Color.Black).width('90%')
      Row({ space: 40 }) {
        Progress({ value: 50, type: ProgressType.ScaleRing }).width(100).style({ strokeWidth: 20, scaleCount: 30, scaleWidth: 9 })
      }

      Text('Ring ').fontSize(15).fontColor(Color.Black).width('90%')
      Row({ space: 40 }) {
        Progress({ value: 50, type: ProgressType.Ring }).width(100).style({ strokeWidth: 8 })
      }

      Text('Capsule ').fontSize(15).fontColor(Color.Black).width('90%')
      Row({ space: 40 }) {
        Progress({ value: 50, type: ProgressType.Capsule }).width(100)
      }
    }.width('100%').margin({ top: 30 })
  }
}

在这里插入图片描述

  • 39
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值