openharmony 鸿蒙 capi-arkui-nativemodule-arkui-nativedialogapi-3

2026-08-25 浏览 (1)

ArkUI_NativeDialogAPI_3

typedef struct {...} ArkUI_NativeDialogAPI_3

Overview

Provides a collection of native-side custom dialog box APIs provided by ArkUI.

Since: 19

Related module: ArkUI_NativeModule

Header file: native_dialog.h

Summary

Member Variables

NameDescription
ArkUI_NativeDialogAPI_1 nativeDialogAPI1Collection of native-side custom dialog box APIs provided by ArkUI, covering the scope of ArkUI_NativeDialogAPI_1.
Since: 19
ArkUI_NativeDialogAPI_2 nativeDialogAPI2Collection of native-side custom dialog box APIs provided by ArkUI, covering the scope of ArkUI_NativeDialogAPI_2.
Since: 19

Member Functions

NameDescription
int32_t (*setLevelOrder)(ArkUI_NativeDialogHandle handle, double levelOrder)Sets the display order of the custom dialog box.
int32_t (*registerOnWillAppear)(ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData))Registers a callback function that is triggered before the custom dialog box appears.
int32_t (*registerOnDidAppear)(ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData))Registers a callback function that is triggered after the custom dialog box appears.
int32_t (*registerOnWillDisappear)(ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData))Registers a callback function that is triggered before the custom dialog box disappears.
int32_t (*registerOnDidDisappear)(ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData))Registers a callback function that is triggered after the custom dialog box disappears.
int32_t (*setBorderWidth)(ArkUI_NativeDialogHandle handle, float top, float right, float bottom, float left, ArkUI_LengthMetricUnit unit)Sets the border width of the custom dialog box.
int32_t (*setBorderColor)(ArkUI_NativeDialogHandle handle, uint32_t top, uint32_t right, uint32_t bottom, uint32_t left)Sets the border color of the custom dialog box.
int32_t (*setBorderStyle)(ArkUI_NativeDialogHandle handle, int32_t top, int32_t right, int32_t bottom, int32_t left)Sets the border style of the custom dialog box.
int32_t (*setWidth)(ArkUI_NativeDialogHandle handle, float width, ArkUI_LengthMetricUnit unit)Sets the backdrop width of the custom dialog box.
int32_t (*setHeight)(ArkUI_NativeDialogHandle handle, float height, ArkUI_LengthMetricUnit unit)Sets the backdrop height of the custom dialog box.
int32_t (*setShadow)(ArkUI_NativeDialogHandle handle, ArkUI_ShadowStyle shadow)Sets the shadow of the custom dialog box's backdrop.
int32_t (*setCustomShadow)(ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* customShadow)Sets the shadow of the custom dialog box's backdrop.
int32_t (*setBackgroundBlurStyle)(ArkUI_NativeDialogHandle handle, ArkUI_BlurStyle blurStyle)Sets the backdrop blur style of the custom dialog box.
int32_t (*setKeyboardAvoidMode)(ArkUI_NativeDialogHandle handle, ArkUI_KeyboardAvoidMode keyboardAvoidMode)Sets the keyboard avoidance mode of the custom dialog box.
int32_t (*enableHoverMode)(ArkUI_NativeDialogHandle handle, bool enableHoverMode)Sets whether the custom dialog box responds when the device is in semi-folded mode.
int32_t (*setHoverModeArea)(ArkUI_NativeDialogHandle handle, ArkUI_HoverModeAreaType hoverModeAreaType)Sets the default display area of the custom dialog box in hover mode.
int32_t (*setFocusable)(ArkUI_NativeDialogHandle handle, bool focusable)Sets whether the custom dialog box can gain focus.
int32_t (*setBackgroundBlurStyleOptions)(ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* backgroundBlurStyleOptions)Sets the background blur effect of the custom dialog box.
int32_t (*setBackgroundEffect)(ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* backgroundEffect)Sets the background effect parameters of the custom dialog box.

Member Function Description

setLevelOrder()

int32_t (*setLevelOrder)(ArkUI_NativeDialogHandle handle, double levelOrder)

Description

Sets the display order of the custom dialog box.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

NameDescription
ArkUI_NativeDialogHandle handlePointer to the custom dialog box controller.
double levelOrderDisplay order of the custom dialog box.
Default value: 0. Value range: [-100000.0, 100000.0]. If the value is out of the range, the setting does not take effect.

Returns

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

registerOnWillAppear()

int32_t (*registerOnWillAppear)(ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData))

Description

Registers a callback function that is triggered before the custom dialog box appears.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

NameDescription
ArkUI_NativeDialogHandle handlePointer to the custom dialog box controller.
void* userDataCustom data.
callbackCallback function that is triggered before the custom dialog box appears.

Returns

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

registerOnDidAppear()

int32_t (*registerOnDidAppear)(ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData))

Description

Registers a callback function that is triggered after the custom dialog box appears.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

NameDescription
ArkUI_NativeDialogHandle handlePointer to the custom dialog box controller.
void* userDataCustom data.
callbackCallback function that is triggered after the custom dialog box appears.

Returns

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

registerOnWillDisappear()

int32_t (*registerOnWillDisappear)(ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData))

Description

Registers a callback function that is triggered before the custom dialog box disappears.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

NameDescription
ArkUI_NativeDialogHandle handlePointer to the custom dialog box controller.
void* userDataCustom data.
callbackCallback function that is triggered before the custom dialog box disappears.

Returns

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

registerOnDidDisappear()

int32_t (*registerOnDidDisappear)(ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData))

Description

Registers a callback function that is triggered after the custom dialog box disappears.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

NameDescription
ArkUI_NativeDialogHandle handlePointer to the custom dialog box controller.
void* userDataCustom data.
callbackCallback function that is triggered after the custom dialog box disappears.

Returns

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

setBorderWidth()

int32_t (*setBorderWidth)(ArkUI_NativeDialogHandle handle, float top, float right, float bottom, float left, ArkUI_LengthMetricUnit unit)

Description

Sets the border width of the custom dialog box.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

NameDescription
ArkUI_NativeDialogHandle handlePointer to the custom dialog box controller.
float topTop border width.
float rightRight border width.
float bottomBottom border width.
float leftLeft border width.
ArkUI_LengthMetricUnit unitUnit of the width. The default value is vp.

Returns

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

setBorderColor()

int32_t (*setBorderColor)(ArkUI_NativeDialogHandle handle, uint32_t top, uint32_t right, uint32_t bottom, uint32_t left)

Description

Sets the border color of the custom dialog box.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

NameDescription
ArkUI_NativeDialogHandle handlePointer to the custom dialog box controller.
uint32_t topTop border color.
uint32_t rightRight border color.
uint32_t bottomBottom border color.
uint32_t leftLeft border color.

Returns

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

setBorderStyle()

int32_t (*setBorderStyle)(ArkUI_NativeDialogHandle handle, int32_t top, int32_t right, int32_t bottom, int32_t left)

Description

Sets the border style of the custom dialog box.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

NameDescription
ArkUI_NativeDialogHandle handlePointer to the custom dialog box controller.
int32_t topTop border style. The parameter type is ArkUI_BorderStyle. The default value is ARKUI_BORDER_STYLE_SOLID.
int32_t rightRight border style. The parameter type is ArkUI_BorderStyle. The default value is ARKUI_BORDER_STYLE_SOLID.
int32_t bottomBottom border style. The parameter type is ArkUI_BorderStyle. The default value is ARKUI_BORDER_STYLE_SOLID.
int32_t leftLeft border style. The parameter type is ArkUI_BorderStyle. The default value is ARKUI_BORDER_STYLE_SOLID.

Returns

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

setWidth()

int32_t (*setWidth)(ArkUI_NativeDialogHandle handle, float width, ArkUI_LengthMetricUnit unit)

Description

Sets the backdrop width of the custom dialog box.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

NameDescription
ArkUI_NativeDialogHandle handlePointer to the custom dialog box controller.
float widthBackdrop width.
ArkUI_LengthMetricUnit unitUnit of the width. The default value is vp.

Returns

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

setHeight()

int32_t (*setHeight)(ArkUI_NativeDialogHandle handle, float height, ArkUI_LengthMetricUnit unit)

Description

Sets the backdrop height of the custom dialog box.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

NameDescription
ArkUI_NativeDialogHandle handlePointer to the custom dialog box controller.
float heightBackdrop height.
ArkUI_LengthMetricUnit unitUnit of the height. The default value is vp.

Returns

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

setShadow()

int32_t (*setShadow)(ArkUI_NativeDialogHandle handle, ArkUI_ShadowStyle shadow)

Description

Sets the shadow of the custom dialog box's backdrop.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

NameDescription
ArkUI_NativeDialogHandle handlePointer to the custom dialog box controller.
ArkUI_ShadowStyle shadowBackdrop shadow style, specified by an enumerated value.

Returns

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

setCustomShadow()

int32_t (*setCustomShadow)(ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* customShadow)

Description

Sets the shadow of the custom dialog box's backdrop.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

NameDescription
ArkUI_NativeDialogHandle handlePointer to the custom dialog box controller.
const ArkUI_AttributeItem* customShadowCustom shadow parameters. The format is consistent with the NODE_SHADOW property in ArkUI_NodeAttributeType.

Returns

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

setBackgroundBlurStyle()

int32_t (*setBackgroundBlurStyle)(ArkUI_NativeDialogHandle handle, ArkUI_BlurStyle blurStyle)

Description

Sets the backdrop blur style of the custom dialog box.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

NameDescription
ArkUI_NativeDialogHandle handlePointer to the custom dialog box controller.
ArkUI_BlurStyle blurStyleBackdrop blur material, specified by an enumerated value.

Returns

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

setKeyboardAvoidMode()

int32_t (*setKeyboardAvoidMode)(ArkUI_NativeDialogHandle handle, ArkUI_KeyboardAvoidMode keyboardAvoidMode)

Description

Sets the keyboard avoidance mode of the custom dialog box.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

NameDescription
ArkUI_NativeDialogHandle handlePointer to the custom dialog box controller.
ArkUI_KeyboardAvoidMode keyboardAvoidModeKeyboard avoidance mode, specified by an enumerated value.

Returns

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

enableHoverMode()

int32_t (*enableHoverMode)(ArkUI_NativeDialogHandle handle, bool enableHoverMode)

Description

Sets whether the custom dialog box responds when the device is in semi-folded mode.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

NameDescription
ArkUI_NativeDialogHandle handlePointer to the custom dialog box controller.
bool enableHoverModeWhether to respond when the device is in semi-folded mode. The default value is false. The value true means to respond when the device is in semi-folded mode, and false means the opposite.

Returns

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

setHoverModeArea()

int32_t (*setHoverModeArea)(ArkUI_NativeDialogHandle handle, ArkUI_HoverModeAreaType hoverModeAreaType)

Description

Sets the default display area of the custom dialog box in hover mode.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

NameDescription
ArkUI_NativeDialogHandle handlePointer to the custom dialog box controller.
ArkUI_HoverModeAreaType hoverModeAreaTypeDisplay area in hover mode, specified by an enumerated value.

Returns

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

setFocusable()

int32_t (*setFocusable)(ArkUI_NativeDialogHandle handle, bool focusable)

Description

Sets whether the custom dialog box can gain focus.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

NameDescription
ArkUI_NativeDialogHandle handlePointer to the custom dialog box controller.
bool focusableWhether the custom dialog box can gain focus. The value true means that the custom dialog box can gain focus, and false means the opposite. The preset value is true.

Returns

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

setBackgroundBlurStyleOptions()

int32_t (*setBackgroundBlurStyleOptions)(ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* backgroundBlurStyleOptions)

Description

Sets the background blur effect of the custom dialog box.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

NameDescription
ArkUI_NativeDialogHandle handlePointer to the custom dialog box controller.
const ArkUI_AttributeItem* backgroundBlurStyleOptionsOptions for customizing the background blur effect. The format of the ArkUI_AttributeItem parameter is as follows:
.value[0].i32: color mode, specified by an enumerated value of ArkUI_ColorMode.
.value[1]?.i32: adaptive color mode, specified by an enumerated value of ArkUI_AdaptiveColor.
.value[2]?.f32: blur degree. The value range is [0.0, 1.0]. If the value is out of the valid range, the boundary value is used.
.value[3]?.u32: brightness of black in the grayscale blur. The value range is [0, 127]. If the value is out of the valid range, 0 is used.
.value[4]?.u32: darkening degree of white in the grayscale blur. The value range is [0, 127]. If the value is out of the valid range, 0 is used.
.value[5]?.i32: blur activation policy, specified by an enumerated value of ArkUI_BlurStyleActivePolicy.
.value[6]?.u32: background color, in 0xARGB format, of the components within the window after the window loses focus (in which case, the blur effect on the components within the window is removed).

Returns

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

setBackgroundEffect()

int32_t (*setBackgroundEffect)(ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* backgroundEffect)

Description

Sets the background effect parameters of the custom dialog box.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

NameDescription
ArkUI_NativeDialogHandle handlePointer to the custom dialog box controller.
const ArkUI_AttributeItem* backgroundEffectBackground effect parameters. The format of the ArkUI_AttributeItem parameter is as follows:
.value[0].f32: blur radius, in vp.
.value[1]?.f32: saturation.
.value[2]?.f32: brightness.
.value[3]?.u32: color, in 0xARGB format.
.value[4]?.i32: adaptive color mode, specified by an enumerated value of ArkUI_AdaptiveColor.
.value[5]?.u32: brightness of black in the grayscale blur. The value range is [0, 127]. If the value is out of the valid range, 0 is used.
.value[6]?.u32: darkening degree of white in the grayscale blur. The value range is [0, 127]. If the value is out of the valid range, 0 is used.
.value[7]?.i32: blur activation policy, specified by an enumerated value of ArkUI_BlurStyleActivePolicy.
.value[8]?.u32: background color, in 0xARGB format, of the components within the window after the window loses focus (in which case, the blur effect on the components within the window is removed).

Returns

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 arkts-apis-uicontext-contextmenucontroller

openharmony 鸿蒙 errorcode-canvas

openharmony 鸿蒙 capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent

openharmony 鸿蒙 errorcode-bindSheet

openharmony 鸿蒙 js-apis-arkui-uiExtension-sys

openharmony 鸿蒙 capi-arkui-accessibility-arkui-accessibilityeventinfo

openharmony 鸿蒙 capi-arkui-rendernodeutils

openharmony 鸿蒙 js-apis-arkui-node

openharmony 鸿蒙 capi-native-node-h

openharmony 鸿蒙 capi-arkui-nativemodule-arkui-listitemswipeactionitem

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/BRtXiIZB