美文网首页
【HarmonyOS】鸿蒙组件下划线与边框

【HarmonyOS】鸿蒙组件下划线与边框

作者: zhongcx | 来源:发表于2024-09-27 08:38 被阅读0次

    给组件添加下划线或者画虚线边框可以使用.borderStyle和.borderWidth
    【效果】


    image.png

    【示例】

    @Entry
    @Component
    struct Page51 {
      build() {
        Column() {
          Text('虚线边框测试')
            .width(200)
            .height(150)
            .borderStyle(BorderStyle.Dashed)
            .borderWidth(1)
            .backgroundColor('#F5F5F5')
          Row() {
            Text('利用底部边框实现添加下划线效果')
              .height('48lpx')
              .margin({ top: '66lpx' })
              .fontSize('28lpx')
              .fontColor("#FF1919")
              .textAlign(TextAlign.Center)
              .borderWidth({ bottom: 1 })
              .borderStyle(BorderStyle.Solid)
              .borderColor("#FF1919")
          }.width('100%').justifyContent(FlexAlign.Center)
    
        }
        .width('100%')
        .height('100%')
      }
    }
    

    相关文章

      网友评论

          本文标题:【HarmonyOS】鸿蒙组件下划线与边框

          本文链接:https://www.haomeiwen.com/subject/gphcrjtx.html