diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-background.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-background.md index 160187ab4a3dfce60d7284b42692f6946e488de6..2d898fce4e7f38e51709bd983a6d8092219f5809 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-background.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-background.md @@ -1,13 +1,12 @@ # Background +You can set the background of a component. -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** +> > This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. -The attributes in this topic are used to set the background color of a component. - - ## Required Permissions None @@ -18,24 +17,25 @@ None | Name | Type | Default Value | Description | | -------- | -------- | -------- | -------- | -| backgroundColor | Color | - | Background color of a component. | -| backgroundImage | src: string,
repeat?: [ImageRepeat](ts-appendix-enums.md#imagerepeat-enums) | - | **src**: image address, which can be the address of an Internet or a local image. (SVG images are not supported.)
**repeat**: whether the background image is repeatedly used. By default, the background image is not repeatedly used. | +| backgroundColor | [ResourceColor](../../ui/ts-types.md) | - | Background color of a component. | +| backgroundImage | src: [ResourceStr](../../ui/ts-types.md),
repeat?: [ImageRepeat](ts-appendix-enums.md#imagerepeat-enums) | - | **src**: image address, which can be the address of an Internet or a local image. (SVG images are not supported.)
**repeat**: whether the background image is repeatedly used. By default, the background image is not repeatedly used. | | backgroundImageSize | {
width?: Length,
height?: Length
} \| ImageSize | Auto | Width and height of the background image. When the input is a **{width: Length, height: Length}** object, if only one attribute is set, the other attribute is the set value multiplied by the original aspect ratio of the image. By default, the original image aspect ratio remains unchanged. | | backgroundImagePosition | {
x?: Length,
y?: Length
} \| [Alignment](ts-appendix-enums.md#alignment-enums) | {
x: 0,
y: 0
} | Position of the background image in the component. | - ImageSize enums - | Name | Description | + | Name | Description | | -------- | -------- | - | Cover | Default value. The image is scaled with its aspect ratio retained for both sides to be greater than or equal to the display boundaries. | - | Contain | The image is scaled with its aspect ratio retained for the content to be completely displayed within the display boundaries. | - | Auto | The original image aspect ratio is retained. | + | Cover | Default value. The image is scaled with its aspect ratio retained for both sides to be greater than or equal to the display boundaries. | + | Contain | The image is scaled with its aspect ratio retained for the content to be completely displayed within the display boundaries. | + | Auto | The original image aspect ratio is retained. | ## Example -``` +```ts +// xxx.ets @Entry @Component struct BackgroundExample {