【Day.3】ArcTS常用组件:按钮儿、滑块儿、行和列

Button在这里插入图片描述

Slider

在这里插入图片描述

Column&Row

黑马的课
在这里插入图片描述
在这里插入图片描述

@Entry
@Component
struct Index {
  @State imageWidth:number=250
  build() {
    Row() {

      Column() {
        Row(){
          Image($r('app.media.my_icon'))
            .width(this.imageWidth)
            .borderRadius(10)
        }
          .justifyContent(FlexAlign.Center)
          .width('100%')
          .height(400)
          .padding(20)
        Row(){
          Text('图片宽度:')
            .fontColor('black')
            .fontSize(20)
            .fontWeight(FontWeight.Bold)
            .backgroundColor('#ffff75fc')
          TextInput({text:this.imageWidth.toFixed(0)})
            .width(150)
            .backgroundColor('#ffdd3333')
            .onChange(value=>{
              this.imageWidth=parseInt(value)
            })
        }
        .width('100%')
        .padding(20)//用来调整边距
        .justifyContent(FlexAlign.SpaceBetween)
        Divider()
        .width('90%')

        Row(){
          Button('放大')
            .onClick(()=>{
              if(this.imageWidth<360)
                this.imageWidth+=10
            })
            .backgroundColor('#ff3edd33')
          Button('缩小')
            .onClick(()=>{
              if(this.imageWidth>50)
                this.imageWidth-=10
            })
            .backgroundColor('#ff66dd33')
        }
        .width('100%')
        .justifyContent(FlexAlign.SpaceEvenly)


        Slider({
          min:100,
          max:300,
          value:this.imageWidth,
          step:3
        })
          .width('90%')
          .blockColor('#36D')
          .showTips(true)
          .trackThickness('10')
          .onChange(value=>{
            this.imageWidth=value
          })
          .trackColor('#ff33ddbb')
      }
        .height('100%')
    }
  }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值