元素

SVG

随意放大缩小,随意改变颜色

官方

https://www.developer.huawei.com/consumer/cn/design/harmonyos-icon/

图标

 1@Entry  2@Component  3struct Index {  4 build() {  5 RelativeContainer() {  6 Column({  7 space: 10  8 }) {  9 Image($r('app.media.app_icon')) 10 .width(28) 11 .fillColor(Color.Yellow) 12 }.padding(20) 13 } 14 } 15}
@Entry @Component struct Index { build() { RelativeContainer() { Column({ space: 10 }) { Image($r('app.media.app_icon')) .width(28) .fillColor(Color.Yellow) }.padding(20) } } }

边框

 1@Entry  2@Component  3struct Index {  4 build() {  5 RelativeContainer() {  6 Column({ space: 10 }) {  7 Text('待完善')  8 .padding(10)  9 .border({ 10 width: 1, 11 color: Color.Red, 12 style: BorderStyle.Dashed 13 }) 14 Text('资料') 15 .padding(10) 16 .border({ 17 width: { 18 left: 1, 19 right: 2 20 }, 21 color: { 22 left: Color.Red, 23 right: Color.Blue 24 }, 25 style: { 26 left: BorderStyle.Dashed, 27 right: BorderStyle.Dotted 28 } 29 }) 30 }.padding(20) 31 } 32 } 33}
@Entry @Component struct Index { build() { RelativeContainer() { Column({ space: 10 }) { Text('待完善') .padding(10) .border({ width: 1, color: Color.Red, style: BorderStyle.Dashed }) Text('资料') .padding(10) .border({ width: { left: 1, right: 2 }, color: { left: Color.Red, right: Color.Blue }, style: { left: BorderStyle.Dashed, right: BorderStyle.Dotted } }) }.padding(20) } } }

QQ

 1@Entry  2@Component  3struct Index {  4 build() {  5 RelativeContainer() {  6 Column() {  7 Image($r('app.media.app_icon'))  8 .width(28)  9 Text('大王叫我来巡山') 10 .fontWeight(700) 11 .margin({ 12 top: 10, 13 bottom: 20 14 }) 15 Button('QQ登录') 16 .width('100%') 17 .margin({ 18 bottom: 10 19 }) 20 Button('微信登录') 21 .width('100%') 22 .backgroundColor('#ddd') 23 .fontColor('#000') 24 }.width('100%') 25 .padding(20) 26 } 27 } 28}
@Entry @Component struct Index { build() { RelativeContainer() { Column() { Image($r('app.media.app_icon')) .width(28) Text('大王叫我来巡山') .fontWeight(700) .margin({ top: 10, bottom: 20 }) Button('QQ登录') .width('100%') .margin({ bottom: 10 }) Button('微信登录') .width('100%') .backgroundColor('#ddd') .fontColor('#000') }.width('100%') .padding(20) } } }

圆角

 1@Entry  2@Component  3struct Index {  4 build() {  5 RelativeContainer() {  6 Column({  7 space: 10  8 }) {  9 Text('组件内容') 10 .backgroundColor(Color.Orange) 11 .padding(20) 12 Text('组件内容') 13 .border({ 14 width: 5, 15 color: Color.Red, 16 radius: 10 17 }) 18 .backgroundColor(Color.Orange) 19 .padding({ 20 top: 10, 21 right: 20, 22 bottom: 10, 23 left: 20 24 }) 25 .margin({ 26 top: 30 27 }) 28 Text('圆角') 29 .padding(30) 30 .backgroundColor(Color.Orange) 31 .borderRadius(20) 32 .borderRadius({ 33 topLeft: 5, 34 topRight: 5, 35 bottomLeft: 10, 36 bottomRight: 20 37 }) 38 } 39 } 40 } 41}
@Entry @Component struct Index { build() { RelativeContainer() { Column({ space: 10 }) { Text('组件内容') .backgroundColor(Color.Orange) .padding(20) Text('组件内容') .border({ width: 5, color: Color.Red, radius: 10 }) .backgroundColor(Color.Orange) .padding({ top: 10, right: 20, bottom: 10, left: 20 }) .margin({ top: 30 }) Text('圆角') .padding(30) .backgroundColor(Color.Orange) .borderRadius(20) .borderRadius({ topLeft: 5, topRight: 5, bottomLeft: 10, bottomRight: 20 }) } } } }

正圆

 1@Entry  2@Component  3struct Index {  4 build() {  5 RelativeContainer() {  6 Column({  7 space: 10  8 }) {  9 Text('正圆') 10 .width(100) 11 .height(100) 12 .textAlign(TextAlign.Center) 13 .backgroundColor(Color.Orange) 14 .borderRadius(50) 15 16 Text('胶囊按钮') 17 .width(200) 18 .height(60) 19 .textAlign(TextAlign.Center) 20 .backgroundColor(Color.Orange) 21 .borderRadius(30) 22 }.padding(30) 23 } 24 } 25}
@Entry @Component struct Index { build() { RelativeContainer() { Column({ space: 10 }) { Text('正圆') .width(100) .height(100) .textAlign(TextAlign.Center) .backgroundColor(Color.Orange) .borderRadius(50) Text('胶囊按钮') .width(200) .height(60) .textAlign(TextAlign.Center) .backgroundColor(Color.Orange) .borderRadius(30) }.padding(30) } } }

背景

 1@Entry  2@Component  3struct Index {  4 build() {  5 RelativeContainer() {  6 Column({  7 space: 10  8 }) {  9 Row({ space: 10 }) { 10 Text('正圆') 11 .padding(50) 12 .backgroundColor(Color.Gray) 13 .backgroundImage($r('app.media.startIcon'), ImageRepeat.XY) 14 .backgroundImagePosition({ 15 x: 10, y: 10 16 }) 17 .width(60) 18 .height(60) 19 20 Text('正圆') 21 .padding(50) 22 .backgroundColor(Color.Gray) 23 .backgroundImage($r('app.media.startIcon')) 24 .backgroundImagePosition({ 25 x: 10, y: 10 26 }) 27 .width(60) 28 .height(60) 29 30 Text('正圆') 31 .padding(50) 32 .backgroundColor(Color.Gray) 33 .backgroundImage($r('app.media.startIcon')) 34 .backgroundImagePosition(Alignment.Center) 35 .width(60) 36 .height(60) 37 } 38 }.padding(15) 39 } 40 } 41}
@Entry @Component struct Index { build() { RelativeContainer() { Column({ space: 10 }) { Row({ space: 10 }) { Text('正圆') .padding(50) .backgroundColor(Color.Gray) .backgroundImage($r('app.media.startIcon'), ImageRepeat.XY) .backgroundImagePosition({ x: 10, y: 10 }) .width(60) .height(60) Text('正圆') .padding(50) .backgroundColor(Color.Gray) .backgroundImage($r('app.media.startIcon')) .backgroundImagePosition({ x: 10, y: 10 }) .width(60) .height(60) Text('正圆') .padding(50) .backgroundColor(Color.Gray) .backgroundImage($r('app.media.startIcon')) .backgroundImagePosition(Alignment.Center) .width(60) .height(60) } }.padding(15) } } }

Powered By 可尔物语

浙ICP备11005866号-12