Background Settings
Note:
Currently in the beta phase.
Configure the background style of components.
Import Module
import kit.ArkUI.*
func backgroundColor(?ResourceColor)
func backgroundColor(value: ?ResourceColor): T
Description: Sets the background color of a component.
System Capability: SystemCapability.ArkUI.ArkUI.Full
Since: 22
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| value | ?ResourceColor | Yes | - | Background color. Initial value: Color.Transparent |
Return Value:
| Type | Description |
|---|---|
| T | Returns the component instance itself that calls this interface. |
func backgroundImage(?ResourceStr)
func backgroundImage(src: ?ResourceStr): T
Description: Sets the background image of a component.
System Capability: SystemCapability.ArkUI.ArkUI.Full
Since: 22
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| src | ?ResourceStr | Yes | - | Image resource path. |
Return Value:
| Type | Description |
|---|---|
| T | Returns the component instance itself that calls this interface. |
func backgroundImage(?ResourceStr, ?ImageRepeat)
func backgroundImage(src: ?ResourceStr, repeat: ?ImageRepeat): T
Description: Sets the background image and repeat mode of a component.
System Capability: SystemCapability.ArkUI.ArkUI.Full
Since: 22
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| src | ?ResourceStr | Yes | - | Image resource path. |
| repeat | ?ImageRepeat | Yes | - | Image repeat mode. Initial value: ImageRepeat.NoRepeat |
Return Value:
| Type | Description |
|---|---|
| T | Returns the component instance itself that calls this interface. |
func backgroundImagePosition(?Alignment)
func backgroundImagePosition(value: ?Alignment): T
Description: Sets the alignment of the background image.
System Capability: SystemCapability.ArkUI.ArkUI.Full
Since: 22
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| value | ?Alignment | Yes | - | Alignment mode. |
Return Value:
| Type | Description |
|---|---|
| T | Returns the component instance itself that calls this interface. |
func backgroundImagePosition(?Length, ?Length)
func backgroundImagePosition(x!: ?Length, y!: ?Length): T
Description: Sets the position of the background image.
System Capability: SystemCapability.ArkUI.ArkUI.Full
Since: 22
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| x | ?Length | Yes | - | Named parameter. X-axis position. Initial value: 0.vp |
| y | ?Length | Yes | - | Named parameter. Y-axis position. Initial value: 0.vp |
Return Value:
| Type | Description |
|---|---|
| T | Returns the component instance itself that calls this interface. |
func backgroundImageSize(?ImageSize)
func backgroundImageSize(value: ?ImageSize): T
Description: Sets the size of the background image.
System Capability: SystemCapability.ArkUI.ArkUI.Full
Since: 22
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| value | ?ImageSize | Yes | - | Image size. |
Return Value:
| Type | Description |
|---|---|
| T | Returns the component instance itself that calls this interface. |
func backgroundImageSize(?Length, ?Length)
func backgroundImageSize(width!: ?Length, height!: ?Length): T
Description: Sets the width and height of the background image.
System Capability: SystemCapability.ArkUI.ArkUI.Full
Since: 22
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| width | ?Length | Yes | - | Named parameter. Image width. Initial value: 0.vp |
| height | ?Length | Yes | - | Named parameter. Image height. Initial value: 0.vp |
Return Value:
| Type | Description |
|---|---|
| T | Returns the component instance itself that calls this interface. |