Divider
提供分隔器組件,分隔不同內(nèi)容塊/內(nèi)容元素。
說明:
開發(fā)前請熟悉鴻蒙開發(fā)指導(dǎo)文檔 :[gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md]點(diǎn)擊或者復(fù)制轉(zhuǎn)到。
該組件從API Version 7開始支持。后續(xù)版本如有新增內(nèi)容,則采用上角標(biāo)單獨(dú)標(biāo)記該內(nèi)容的起始版本。
子組件
無
接口
Divider()
從API version 9開始,該接口支持在ArkTS卡片中使用。
屬性
除支持[通用屬性]外,還支持以下屬性:
名稱 | 參數(shù)類型 | 描述 |
---|---|---|
vertical | boolean | 使用水平分割線還是垂直分割線。false:水平分割線;true:垂直分割線。 默認(rèn)值:false 從API version 9開始,該接口支持在ArkTS卡片中使用。 |
color | [ResourceColor] | 分割線顏色。 默認(rèn)值:'#33182431' 從API version 9開始,該接口支持在ArkTS卡片中使用。 |
strokeWidth | number | string |
lineCap | [LineCapStyle] | 分割線的端點(diǎn)樣式。 默認(rèn)值:LineCapStyle.Butt 從API version 9開始,該接口支持在ArkTS卡片中使用。HarmonyOS與OpenHarmony鴻蒙文檔籽料:mau123789是v直接拿 |
示例
// xxx.ets
@Entry
@Component
struct DividerExample {
build() {
Column() {
// 使用橫向分割線場景
Text('Horizontal divider').fontSize(9).fontColor(0xCCCCCC)
List() {
ForEach([1, 2, 3], (item: number) = > {
ListItem() {
Text('list' + item).width('100%').fontSize(14).fontColor('#182431').textAlign(TextAlign.Start)
}.width(244).height(48)
}, (item: number) = > item.toString())
}.padding({ left: 24, bottom: 8 })
Divider().strokeWidth(8).color('#F1F3F5')
List() {
ForEach([4, 5], (item: number) = > {
ListItem() {
Text('list' + item).width('100%').fontSize(14).fontColor('#182431').textAlign(TextAlign.Start)
}.width(244).height(48)
}, (item: number) = > item.toString())
}.padding({ left: 24, top: 8 })
// 使用縱向分割線場景
Text('Vertical divider').fontSize(9).fontColor(0xCCCCCC)
Column() {
Column() {
Row().width(288).height(64).backgroundColor('#30C9F0').opacity(0.3)
Row() {
Button('Button')
.width(136)
.height(22)
.fontSize(16)
.fontColor('#007DFF')
.fontWeight(500)
.backgroundColor(Color.Transparent)
Divider().vertical(true).height(22).color('#182431').opacity(0.6).margin({ left: 8, right: 8 })
Button('Button')
.width(136)
.height(22)
.fontSize(16)
.fontColor('#007DFF')
.fontWeight(500)
.backgroundColor(Color.Transparent)
}.margin({ top: 17 })
}
.width(336)
.height(152)
.backgroundColor('#FFFFFF')
.borderRadius(24)
.padding(24)
}
.width('100%')
.height(168)
.backgroundColor('#F1F3F5')
.justifyContent(FlexAlign.Center)
.margin({ top: 8 })
}.width('100%').padding({ top: 24 })
}
}
-
接口
+關(guān)注
關(guān)注
33文章
8968瀏覽量
153367 -
組件
+關(guān)注
關(guān)注
1文章
531瀏覽量
18347 -
鴻蒙
+關(guān)注
關(guān)注
59文章
2545瀏覽量
43843
發(fā)布評論請先 登錄
鴻蒙開發(fā)基礎(chǔ)-Web組件之cookie操作
HarmonyOS/OpenHarmony應(yīng)用開發(fā)-ArkTS的聲明式開發(fā)范式
HarmonyOS/OpenHarmony應(yīng)用開發(fā)-ArkTS語言聲明式UI描述
鴻蒙ArkTS聲明式組件:PatternLock

評論