未验证 提交 a3314d66 编写于 作者: O openharmony_ci 提交者: Gitee

!20677 修改image示例代码+示例图

Merge pull request !20677 from LiAn/master
...@@ -97,61 +97,27 @@ Image(src: PixelMap | ResourceStr | DrawableDescriptor) ...@@ -97,61 +97,27 @@ Image(src: PixelMap | ResourceStr | DrawableDescriptor)
@Entry @Entry
@Component @Component
struct ImageExample1 { struct ImageExample1 {
private on: string = 'www.example.com'
@State src: string = this.on
build() { build() {
Column() { Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start }) { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start }) {
Text('default').fontSize(16).fontColor(0xcccccc).height(30)
Row({ space: 5 }) { Row({ space: 5 }) {
Image($r('app.media.ic_png')) Image($r('app.media.example_png'))
.width(110).height(110).border({ width: 1 }) .width(110).height(110).border({ width: 1 })
.overlay('png', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('png', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
Image($r('app.media.ic_gif')) Image($r('app.media.example_gif'))
.width(110).height(110).border({ width: 1 }) .width(110).height(110).border({ width: 1 })
.overlay('gif', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('gif', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
Image($r('app.media.ic_svg'))
.width(110).height(110).border({ width: 1 })
.overlay('svg', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
} }
Row({ space: 5 }) { Row({ space: 5 }) {
Image($r('app.media.img_example')) Image($r('app.media.example_svg'))
.width(110).height(110).border({ width: 1 }) .width(110).height(110).border({ width: 1 })
.overlay('jpg', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('svg', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
Image(this.src) Image($r('app.media.example_jpg'))
.width(110).height(110).border({ width: 1 }) .width(110).height(110).border({ width: 1 })
.overlay('network', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .overlay('jpg', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
}.margin({ top: 25, bottom: 10 }) }.margin({ top: 25, bottom: 10 })
} }
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start }) {
Text('objectFit').fontSize(16).fontColor(0xcccccc).height(30)
Row({ space: 5 }) {
Image($r('app.media.img_example'))
.border({ width: 1 })
.objectFit(ImageFit.None).width(110).height(110)
.overlay('None', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
Image($r('app.media.img_example'))
.border({ width: 1 })
.objectFit(ImageFit.Fill).width(110).height(110)
.overlay('Fill', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
Image($r('app.media.img_example'))
.border({ width: 1 })
.objectFit(ImageFit.Cover).width(110).height(110)
.overlay('Cover', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
}
Row({ space: 5 }) {
Image($r('app.media.img_example_w250'))
.border({ width: 1 })
.objectFit(ImageFit.Contain).width(110).height(110)
.overlay('Contain', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
Image($r('app.media.img_example_w250'))
.border({ width: 1 })
.objectFit(ImageFit.ScaleDown).width(110).height(110)
.overlay('ScaleDown', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
}.margin({ top: 25 })
}
}.height(320).width(360).padding({ right: 10, top: 10 }) }.height(320).width(360).padding({ right: 10, top: 10 })
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册