We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All

ArkUI_NodeAttributeType (General Attribute)

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
enum ArkUI_NodeAttributeType

Overview

Enumerates the general attribute types that can be set by ArkUI on the native side.

Since: 12

Related module: ArkUI_NativeModule

Header file: native_node.h

NODE_WIDTH

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
NODE_WIDTH = 0

Width attribute, which can be set, reset, and obtained as required through APIs.

The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

Expand
Name Description
.value[0].f32 Width, in vp, used to set the component width.

Returns

Expand
Type Description
.value[0].f32 Width, in vp.

NODE_HEIGHT

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
NODE_HEIGHT = 1

Height attribute, which can be set, reset, and obtained as required through APIs.

The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

Expand
Name Description
.value[0].f32 Height, in vp, used to set the component height. Negative values are not supported.

Returns

Expand
Type Description
.value[0].f32 Height, in vp.

NODE_BACKGROUND_COLOR

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
NODE_BACKGROUND_COLOR = 2

Background color attribute, which can be set, reset, and obtained as required through APIs.

The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

Expand
Name Description
.value[0].u32 Background color, in 0xARGB format. For example, 0xFFFF0000 indicates red.

Returns

Expand
Type Description
.value[0].u32 Background color, in 0xARGB format. For example, 0xFFFF0000 indicates red.

NODE_BACKGROUND_IMAGE

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
NODE_BACKGROUND_IMAGE = 3

Background image attribute, which can be set, reset, and obtained as required through APIs.

The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

Expand
Name Description
.string Image address. In API version 22 and earlier versions, the value can be a network image resource address, local image resource address, Base64 string, or PixelMap resource, but cannot be the address of an animated image such as an SVG, GIF, or WebP image. In API version 23 and later versions, animated images of the WebP and GIF types are supported. Only the first frame of the animated image is displayed. Other types of animated images are not supported.
.value[0]?.i32 Whether the image is repeated. This parameter is optional. The parameter type is ArkUI_ImageRepeat. The default value is ARKUI_IMAGE_REPEAT_NONE.
.object

PixelMap object. The parameter type is ArkUI_DrawableDescriptor.

Either .object or .string must be set.

Returns

Expand
Type Description
.string Image address. In API version 22 and earlier versions, the value can be a network image resource address, local image resource address, Base64 string, or PixelMap resource, but cannot be the address of an animated image such as an SVG, GIF, or WebP image. In API version 23 and later versions, animated images of the WebP and GIF types are supported. Only the first frame of the animated image is displayed. Other types of animated images are not supported.
.value[0].i32 Whether the image is repeated. The parameter type is ArkUI_ImageRepeat.
.object PixelMap object. The parameter type is ArkUI_DrawableDescriptor.