1 Star 0 Fork 5.3K

OpenHarmony-build / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ts-universal-attributes-border.md 7.36 KB
一键复制 编辑 原始数据 按行查看 历史
zengyawen 提交于 2021-11-10 20:02 . add arkui

边框设置

设置组件边框样式。

名称

参数类型

默认值

描述

border

{

width?: Length,

color?: Color,

radius?: Length,

style?: BorderStyle

}

-

统一边框样式设置接口。

borderStyle

BorderStyle

Solid

设置元素的边框样式。

borderWidth

Length

0

设置元素的边框宽度。

borderColor

Color

-

设置元素的边框颜色。

borderRadius

Length

0

设置元素的边框圆角半径。

  • BorderStyle枚举说明

    名称

    描述

    Dotted

    显示为一系列圆点,圆点半径为borderWidth的一半。

    Dashed

    显示为一系列短的方形虚线。

    Solid

    显示为一条实线。

示例

@Entry
@Component
struct BorderExample {
  build() {
    Flex({ justifyContent: FlexAlign.SpaceAround, alignItems: ItemAlign.Center }) {
      // 线段
      Text('dashed')
        .borderStyle(BorderStyle.Dashed).borderWidth(5).borderColor(0xAFEEEE).borderRadius(10)
        .width(120).height(120).textAlign(TextAlign.Center).fontSize(16)
      // 点线
      Text('dotted')
        .border({ width: 5, color: 0x317AF7, radius: 10, style: BorderStyle.Dotted })
        .width(120).height(120).textAlign(TextAlign.Center).fontSize(16)
    }.width('100%').height(150)
  }
}

1
https://gitee.com/openharmony-build/docs.git
git@gitee.com:openharmony-build/docs.git
openharmony-build
docs
docs
master

搜索帮助