1# native_dialog.h 2<!--Kit: ArkUI--> 3<!--Subsystem: ArkUI--> 4<!--Owner: @houguobiao--> 5<!--Designer: @liyi0309--> 6<!--Tester: @lxl007--> 7<!--Adviser: @HelloCrease--> 8 9## 概述 10 11提供ArkUI在Native侧的自定义弹窗接口定义集合。 12 13**引用文件:** <arkui/native_dialog.h> 14 15**库:** libace_ndk.z.so 16 17**系统能力:** SystemCapability.ArkUI.ArkUI.Full 18 19**起始版本:** 12 20 21**相关模块:** [ArkUI_NativeModule](capi-arkui-nativemodule.md) 22 23## 汇总 24 25### 结构体 26 27| 名称 | typedef关键字 | 描述 | 28| -- | -- | -- | 29| [ArkUI_NativeDialogAPI_1](capi-arkui-nativemodule-arkui-nativedialogapi-1.md) | ArkUI_NativeDialogAPI_1 | ArkUI提供的Native侧自定义弹窗接口集合。 | 30| [ArkUI_NativeDialogAPI_2](capi-arkui-nativemodule-arkui-nativedialogapi-2.md) | ArkUI_NativeDialogAPI_2 | ArkUI提供的Native侧自定义弹窗接口集合。 | 31| [ArkUI_NativeDialogAPI_3](capi-arkui-nativemodule-arkui-nativedialogapi-3.md) | ArkUI_NativeDialogAPI_3 | ArkUI提供的Native侧自定义弹窗接口集合。 | 32| [ArkUI_DialogDismissEvent](capi-arkui-nativemodule-arkui-dialogdismissevent.md) | ArkUI_DialogDismissEvent | 定义弹窗关闭事件对象。 | 33| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md) | ArkUI_CustomDialogOptions | 定义自定义弹窗的内容对象。 | 34 35### 枚举 36 37| 名称 | typedef关键字 | 描述 | 38| -- | -- | -- | 39| [ArkUI_DismissReason](#arkui_dismissreason) | ArkUI_DismissReason | 弹窗关闭的触发方式。 | 40| [ArkUI_LevelMode](#arkui_levelmode) | ArkUI_LevelMode | 设置弹窗显示层级。 | 41| [ArkUI_ImmersiveMode](#arkui_immersivemode) | ArkUI_ImmersiveMode | 指定嵌入式弹窗的蒙层覆盖区域。 | 42| [ArkUI_DialogState](#arkui_dialogstate) | ArkUI_DialogState | 枚举对话框的状态。 | 43 44### 函数 45 46| 名称 | typedef关键字 | 描述 | 47| -- | -- | -- | 48| [typedef bool (\*ArkUI_OnWillDismissEvent)(int32_t reason)](#arkui_onwilldismissevent) | ArkUI_OnWillDismissEvent | 弹窗关闭的回调函数。 | 49| [void OH_ArkUI_DialogDismissEvent_SetShouldBlockDismiss(ArkUI_DialogDismissEvent* event, bool shouldBlockDismiss)](#oh_arkui_dialogdismissevent_setshouldblockdismiss) | - | 设置是否需要屏蔽系统关闭弹窗行为,true表示屏蔽系统行为不关闭弹窗,false表示不屏蔽。 | 50| [void* OH_ArkUI_DialogDismissEvent_GetUserData(ArkUI_DialogDismissEvent* event)](#oh_arkui_dialogdismissevent_getuserdata) | - | 获取弹窗关闭事件对象中的用户自定义数据指针。 | 51| [int32_t OH_ArkUI_DialogDismissEvent_GetDismissReason(ArkUI_DialogDismissEvent* event)](#oh_arkui_dialogdismissevent_getdismissreason) | - | 获取交互式关闭事件指针中的关闭原因。 | 52| [int32_t OH_ArkUI_CustomDialog_OpenDialog(ArkUI_CustomDialogOptions* options, void (\*callback)(int32_t dialogId))](#oh_arkui_customdialog_opendialog) | - | 弹出自定义弹窗。 | 53| [int32_t OH_ArkUI_CustomDialog_UpdateDialog(ArkUI_CustomDialogOptions* options, void (*callback)(int32_t dialogId))](#oh_arkui_customdialog_updatedialog) | - | 更新自定义弹窗。 | 54| [int32_t OH_ArkUI_CustomDialog_CloseDialog(int32_t dialogId)](#oh_arkui_customdialog_closedialog) | - | 关闭自定义弹窗。 | 55| [ArkUI_CustomDialogOptions* OH_ArkUI_CustomDialog_CreateOptions(ArkUI_NodeHandle content)](#oh_arkui_customdialog_createoptions) | - | 创建自定义弹窗options。 | 56| [void OH_ArkUI_CustomDialog_DisposeOptions(ArkUI_CustomDialogOptions* options)](#oh_arkui_customdialog_disposeoptions) | - | 销毁自定义弹窗options. | 57| [int32_t OH_ArkUI_CustomDialog_SetLevelMode(ArkUI_CustomDialogOptions* options, ArkUI_LevelMode levelMode)](#oh_arkui_customdialog_setlevelmode) | - | 设置弹窗的显示层级。 | 58| [int32_t OH_ArkUI_CustomDialog_SetLevelUniqueId(ArkUI_CustomDialogOptions* options, int32_t uniqueId)](#oh_arkui_customdialog_setleveluniqueid) | - | 设置弹窗显示层级页面下的节点id。 | 59| [int32_t OH_ArkUI_CustomDialog_SetImmersiveMode(ArkUI_CustomDialogOptions* options, ArkUI_ImmersiveMode immersiveMode)](#oh_arkui_customdialog_setimmersivemode) | - | 设置嵌入式弹窗蒙层的显示区域。 | 60| [int32_t OH_ArkUI_CustomDialog_SetBackgroundColor(ArkUI_CustomDialogOptions* options, uint32_t backgroundColor)](#oh_arkui_customdialog_setbackgroundcolor) | - | 设置弹窗的背景颜色。 | 61| [int32_t OH_ArkUI_CustomDialog_SetCornerRadius(ArkUI_CustomDialogOptions* options, float topLeft, float topRight, float bottomLeft, float bottomRight)](#oh_arkui_customdialog_setcornerradius) | - | 设置弹窗的圆角半径。 | 62| [int32_t OH_ArkUI_CustomDialog_SetBorderWidth(ArkUI_CustomDialogOptions* options, float top, float right, float bottom, float left, ArkUI_LengthMetricUnit unit)](#oh_arkui_customdialog_setborderwidth) | - | 设置弹窗的边框宽度。 | 63| [int32_t OH_ArkUI_CustomDialog_SetBorderColor(ArkUI_CustomDialogOptions* options, uint32_t top, uint32_t right, uint32_t bottom, uint32_t left)](#oh_arkui_customdialog_setbordercolor) | - | 设置弹窗的边框颜色。 | 64| [int32_t OH_ArkUI_CustomDialog_SetBorderStyle(ArkUI_CustomDialogOptions* options, int32_t top, int32_t right, int32_t bottom, int32_t left)](#oh_arkui_customdialog_setborderstyle) | - | 设置弹窗的边框样式。 | 65| [int32_t OH_ArkUI_CustomDialog_SetWidth(ArkUI_CustomDialogOptions* options, float width, ArkUI_LengthMetricUnit unit)](#oh_arkui_customdialog_setwidth) | - | 设置弹窗的背板宽度。 | 66| [int32_t OH_ArkUI_CustomDialog_SetHeight(ArkUI_CustomDialogOptions* options, float height, ArkUI_LengthMetricUnit unit)](#oh_arkui_customdialog_setheight) | - | 设置弹窗的背板高度。 | 67| [int32_t OH_ArkUI_CustomDialog_SetShadow(ArkUI_CustomDialogOptions* options, ArkUI_ShadowStyle shadow)](#oh_arkui_customdialog_setshadow) | - | 设置弹窗的背板阴影。 | 68| [int32_t OH_ArkUI_CustomDialog_SetCustomShadow(ArkUI_CustomDialogOptions* options, const ArkUI_AttributeItem* customShadow)](#oh_arkui_customdialog_setcustomshadow) | - | 设置弹窗的背板阴影。 | 69| [int32_t OH_ArkUI_CustomDialog_SetBackgroundBlurStyle(ArkUI_CustomDialogOptions* options, ArkUI_BlurStyle blurStyle)](#oh_arkui_customdialog_setbackgroundblurstyle) | - | 设置弹窗的背板模糊材质。 | 70| [int32_t OH_ArkUI_CustomDialog_SetAlignment(ArkUI_CustomDialogOptions* options, int32_t alignment, float offsetX, float offsetY)](#oh_arkui_customdialog_setalignment) | - | 设置弹窗的对齐模式。 | 71| [int32_t OH_ArkUI_CustomDialog_SetModalMode(ArkUI_CustomDialogOptions* options, bool isModal)](#oh_arkui_customdialog_setmodalmode) | - | 设置自定义弹窗是否开启模态样式的弹窗。 | 72| [int32_t OH_ArkUI_CustomDialog_SetAutoCancel(ArkUI_CustomDialogOptions* options, bool autoCancel)](#oh_arkui_customdialog_setautocancel) | - | 设置自定义弹窗是否允许点击遮罩层退出。 | 73| [int32_t OH_ArkUI_CustomDialog_SetSubwindowMode(ArkUI_CustomDialogOptions* options, bool showInSubwindow)](#oh_arkui_customdialog_setsubwindowmode) | - | 设置弹窗是否在子窗口显示此弹窗。 | 74| [int32_t OH_ArkUI_CustomDialog_SetMask(ArkUI_CustomDialogOptions* options, uint32_t maskColor, const ArkUI_Rect* maskRect)](#oh_arkui_customdialog_setmask) | - | 设置自定义弹窗遮罩属性。 | 75| [int32_t OH_ArkUI_CustomDialog_SetKeyboardAvoidMode(ArkUI_CustomDialogOptions* options, ArkUI_KeyboardAvoidMode keyboardAvoidMode)](#oh_arkui_customdialog_setkeyboardavoidmode) | - | 设置弹窗避让键盘的模式。 | 76| [int32_t OH_ArkUI_CustomDialog_SetHoverModeEnabled(ArkUI_CustomDialogOptions* options, bool enabled)](#oh_arkui_customdialog_sethovermodeenabled) | - | 设置弹窗是否响应悬停态。 | 77| [int32_t OH_ArkUI_CustomDialog_SetHoverModeArea(ArkUI_CustomDialogOptions* options, ArkUI_HoverModeAreaType hoverModeAreaType)](#oh_arkui_customdialog_sethovermodearea) | - | 设置悬停态下弹窗默认展示区域。 | 78| [int32_t OH_ArkUI_CustomDialog_RegisterOnWillDismissCallback(ArkUI_CustomDialogOptions* options, void* userData, void (\*callback)(ArkUI_DialogDismissEvent* event))](#oh_arkui_customdialog_registeronwilldismisscallback) | - | 注册系统关闭自定义弹窗的监听事件。 | 79| [int32_t OH_ArkUI_CustomDialog_RegisterOnWillAppearCallback(ArkUI_CustomDialogOptions* options, void* userData, void (\*callback)(void* userData))](#oh_arkui_customdialog_registeronwillappearcallback) | - | 注册自定义弹窗显示动效前的监听事件。 | 80| [int32_t OH_ArkUI_CustomDialog_RegisterOnDidAppearCallback(ArkUI_CustomDialogOptions* options, void* userData, void (\*callback)(void* userData))](#oh_arkui_customdialog_registerondidappearcallback) | - | 注册自定义弹窗弹出时的监听事件。 | 81| [int32_t OH_ArkUI_CustomDialog_RegisterOnWillDisappearCallback(ArkUI_CustomDialogOptions* options, void* userData, void (\*callback)(void* userData))](#oh_arkui_customdialog_registeronwilldisappearcallback) | - | 注册自定义弹窗退出动效前的监听事件。 | 82| [int32_t OH_ArkUI_CustomDialog_RegisterOnDidDisappearCallback(ArkUI_CustomDialogOptions* options, void* userData, void (\*callback)(void* userData))](#oh_arkui_customdialog_registerondiddisappearcallback) | - | 注册自定义弹窗消失时的监听事件。 | 83| [int32_t OH_ArkUI_CustomDialog_GetState(ArkUI_NativeDialogHandle handle, ArkUI_DialogState* state)](#oh_arkui_customdialog_getstate) | - | 获取弹窗的状态。 | 84| [int32_t OH_ArkUI_CustomDialog_SetBackgroundBlurStyleOptions(ArkUI_CustomDialogOptions* options, const ArkUI_AttributeItem* backgroundBlurStyleOptions)](#oh_arkui_customdialog_setbackgroundblurstyleoptions) | - | 设置弹窗的背景模糊效果。 | 85| [int32_t OH_ArkUI_CustomDialog_SetBackgroundEffect(ArkUI_CustomDialogOptions* options, const ArkUI_AttributeItem* backgroundEffect)](#oh_arkui_customdialog_setbackgroundeffect) | - | 设置弹窗的背景效果参数。 | 86 87## 枚举类型说明 88 89### ArkUI_DismissReason 90 91``` 92enum ArkUI_DismissReason 93``` 94 95**描述:** 96 97 98弹窗关闭的触发方式。 99 100**起始版本:** 12 101 102| 枚举项 | 描述 | 103| -- | -- | 104| DIALOG_DISMISS_BACK_PRESS = 0 | 系统定义的返回操作、键盘ESC触发。 | 105| DIALOG_DISMISS_TOUCH_OUTSIDE | 点击遮障层触发。 | 106| DIALOG_DISMISS_CLOSE_BUTTON | 点击关闭按钮。 | 107| DIALOG_DISMISS_SLIDE_DOWN | 下拉关闭。 | 108 109### ArkUI_LevelMode 110 111``` 112enum ArkUI_LevelMode 113``` 114 115**描述:** 116 117 118设置弹窗显示层级。 119 120**起始版本:** 15 121 122| 枚举项 | 描述 | 123| -- | -- | 124| ARKUI_LEVEL_MODE_OVERLAY = 0 | 显示在应用最上层。 | 125| ARKUI_LEVEL_MODE_EMBEDDED | 嵌入式显示在应用的页面内。 | 126 127### ArkUI_ImmersiveMode 128 129``` 130enum ArkUI_ImmersiveMode 131``` 132 133**描述:** 134 135 136指定嵌入式弹窗的蒙层覆盖区域。 137 138**起始版本:** 15 139 140| 枚举项 | 描述 | 141| -- | -- | 142| ARKUI_IMMERSIVE_MODE_DEFAULT = 0 | 弹窗蒙层按照显示页面给定的布局约束显示。 | 143| ARKUI_IMMERSIVE_MODE_EXTEND | 弹窗蒙层可扩展至覆盖状态栏和导航条。 | 144 145### ArkUI_DialogState 146 147``` 148enum ArkUI_DialogState 149``` 150 151**描述:** 152 153 154枚举对话框的状态。 155 156**起始版本:** 20 157 158| 枚举项 | 描述 | 159| -- | -- | 160| DIALOG_UNINITIALIZED = 0 | 未初始化,控制器未与dialog绑定时。 | 161| DIALOG_INITIALIZED | 已初始化,控制器与dialog绑定后。 | 162| DIALOG_APPEARING | 显示中,dialog显示动画过程中。 | 163| DIALOG_APPEARED | 已显示,dialog显示动画结束。 | 164| DIALOG_DISAPPEARING | 消失中,dialog消失动画过程中。 | 165| DIALOG_DISAPPEARED | 已消失,dialog消失动画结束后。 | 166 167 168## 函数说明 169 170### ArkUI_OnWillDismissEvent() 171 172``` 173typedef bool (*ArkUI_OnWillDismissEvent)(int32_t reason) 174``` 175 176**描述:** 177 178 179弹窗关闭的回调函数。 180 181**起始版本:** 12 182 183**参数:** 184 185| 名称 | 描述 | 186| -------- | -------- | 187| reason | 触发弹窗关闭的原因。 | 188 189**返回值:** 190 191| 类型 | 说明 | 192| -- | -- | 193| bool | 返回任意值都表示不关闭弹窗。 | 194 195### OH_ArkUI_DialogDismissEvent_SetShouldBlockDismiss() 196 197``` 198void OH_ArkUI_DialogDismissEvent_SetShouldBlockDismiss(ArkUI_DialogDismissEvent* event, bool shouldBlockDismiss) 199``` 200 201**描述:** 202 203 204设置是否需要屏蔽系统关闭弹窗行为,true表示屏蔽系统行为不关闭弹窗,false表示不屏蔽。 205 206**起始版本:** 12 207 208 209**参数:** 210 211| 参数项 | 描述 | 212| -- | -- | 213| [ArkUI_DialogDismissEvent](capi-arkui-nativemodule-arkui-dialogdismissevent.md)* event | 弹窗关闭事件对象指针。 | 214| bool shouldBlockDismiss | 实现需要屏蔽系统关闭弹窗行为。 | 215 216### OH_ArkUI_DialogDismissEvent_GetUserData() 217 218``` 219void* OH_ArkUI_DialogDismissEvent_GetUserData(ArkUI_DialogDismissEvent* event) 220``` 221 222**描述:** 223 224 225获取弹窗关闭事件对象中的用户自定义数据指针。 226 227**起始版本:** 12 228 229 230**参数:** 231 232| 参数项 | 描述 | 233| -- | -- | 234| [ArkUI_DialogDismissEvent](capi-arkui-nativemodule-arkui-dialogdismissevent.md)* event | 弹窗关闭事件对象指针。 | 235 236**返回:** 237 238| 类型 | 说明 | 239| -- | -- | 240| void* | 用户自定义数据指针。 | 241 242### OH_ArkUI_DialogDismissEvent_GetDismissReason() 243 244``` 245int32_t OH_ArkUI_DialogDismissEvent_GetDismissReason(ArkUI_DialogDismissEvent* event) 246``` 247 248**描述:** 249 250 251获取交互式关闭事件指针中的关闭原因。 252 253**起始版本:** 12 254 255 256**参数:** 257 258| 参数项 | 描述 | 259| -- | -- | 260| [ArkUI_DialogDismissEvent](capi-arkui-nativemodule-arkui-dialogdismissevent.md)* event | 弹窗关闭事件对象指针。 | 261 262**返回:** 263 264| 类型 | 说明 | 265| -- | -- | 266| int32_t | 关闭原因,异常情况返回-1。<br> [DIALOG_DISMISS_BACK_PRESS](capi-native-dialog-h.md#arkui_dismissreason) 对应点击三键back、侧滑(左滑/右滑)、键盘ESC关闭。<br> [DIALOG_DISMISS_TOUCH_OUTSIDE](capi-native-dialog-h.md#arkui_dismissreason) 点击遮障层时。<br> [DIALOG_DISMISS_CLOSE_BUTTON](capi-native-dialog-h.md#arkui_dismissreason) 点击关闭按钮。<br> [DIALOG_DISMISS_SLIDE_DOWN](capi-native-dialog-h.md#arkui_dismissreason) 下拉关闭。 | 267 268### OH_ArkUI_CustomDialog_OpenDialog() 269 270``` 271int32_t OH_ArkUI_CustomDialog_OpenDialog(ArkUI_CustomDialogOptions* options, void (*callback)(int32_t dialogId)) 272``` 273 274**描述:** 275 276 277弹出自定义弹窗。 278 279**起始版本:** 19 280 281 282**参数:** 283 284| 参数项 | 描述 | 285|----------------------------------------| -- | 286| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 287| callback | 开启弹窗的回调,返回入参是弹窗ID。 | 288 289**返回:** 290 291| 类型 | 说明 | 292| -- | -- | 293| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 294 295### OH_ArkUI_CustomDialog_UpdateDialog() 296 297``` 298int32_t OH_ArkUI_CustomDialog_UpdateDialog(ArkUI_CustomDialogOptions* options, void (*callback)(int32_t dialogId)) 299``` 300 301**描述:** 302 303 304更新自定义弹窗。 305 306**起始版本:** 19 307 308 309**参数:** 310 311| 参数项 | 描述 | 312| -- | -- | 313| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 314| callback | 更新弹窗的回调,返回入参是弹窗ID。 | 315 316**返回:** 317 318| 类型 | 说明 | 319| -- | -- | 320| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 321 322### OH_ArkUI_CustomDialog_CloseDialog() 323 324``` 325int32_t OH_ArkUI_CustomDialog_CloseDialog(int32_t dialogId) 326``` 327 328**描述:** 329 330 331关闭自定义弹窗。 332 333**起始版本:** 19 334 335 336**参数:** 337 338| 参数项 | 描述 | 339| -- | -- | 340| int32_t dialogId | 需要关闭的弹窗ID。 | 341 342**返回:** 343 344| 类型 | 说明 | 345| -- | -- | 346| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 347 348### OH_ArkUI_CustomDialog_CreateOptions() 349 350``` 351ArkUI_CustomDialogOptions* OH_ArkUI_CustomDialog_CreateOptions(ArkUI_NodeHandle content) 352``` 353 354**描述:** 355 356 357创建自定义弹窗options。 358 359**起始版本:** 19 360 361 362**参数:** 363 364| 参数项 | 描述 | 365| -- | -- | 366| [ArkUI_NodeHandle](capi-arkui-nativemodule-arkui-node8h.md) content | 自定义弹窗的内容。 | 367 368**返回:** 369 370| 类型 | 说明 | 371|--------------------------------| -- | 372| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* | 自定义弹窗options的指针。 | 373 374### OH_ArkUI_CustomDialog_DisposeOptions() 375 376``` 377void OH_ArkUI_CustomDialog_DisposeOptions(ArkUI_CustomDialogOptions* options) 378``` 379 380**描述:** 381 382 383销毁自定义弹窗options。 384 385**起始版本:** 19 386 387 388**参数:** 389 390| 参数项 | 描述 | 391| -- | -- | 392| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 自定义弹窗options的指针。 | 393 394### OH_ArkUI_CustomDialog_SetLevelMode() 395 396``` 397int32_t OH_ArkUI_CustomDialog_SetLevelMode(ArkUI_CustomDialogOptions* options, ArkUI_LevelMode levelMode) 398``` 399 400**描述:** 401 402 403设置弹窗的显示层级。 404 405> **说明:** 406> 407> 本方法需要在调用[OH_ArkUI_CustomDialog_OpenDialog](#oh_arkui_customdialog_opendialog)方法之前调用。 408 409**起始版本:** 19 410 411 412**参数:** 413 414| 参数项 | 描述 | 415| -- | -- | 416| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 指向自定义弹窗options的指针。 | 417| [ArkUI_LevelMode](capi-native-dialog-h.md#arkui_levelmode) levelMode | 显示层级的枚举值, 类型为[ArkUI_LevelMode](capi-native-dialog-h.md#arkui_levelmode)。 | 418 419**返回:** 420 421| 类型 | 说明 | 422| -- | -- | 423| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 424 425### OH_ArkUI_CustomDialog_SetLevelUniqueId() 426 427``` 428int32_t OH_ArkUI_CustomDialog_SetLevelUniqueId(ArkUI_CustomDialogOptions* options, int32_t uniqueId) 429``` 430 431**描述:** 432 433 434设置弹窗显示层级页面下的节点id。 435 436> **说明:** 437> 438> 本方法需要在调用[OH_ArkUI_CustomDialog_OpenDialog](#oh_arkui_customdialog_opendialog)方法之前调用。 439 440**起始版本:** 19 441 442 443**参数:** 444 445| 参数项 | 描述 | 446| -- | -- | 447| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 指向自定义弹窗options的指针。 | 448| int32_t uniqueId | 指定节点id,会查找该节点所在页面,并将弹窗显示在该页面下。 | 449 450**返回:** 451 452| 类型 | 说明 | 453| -- | -- | 454| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 455 456### OH_ArkUI_CustomDialog_SetImmersiveMode() 457 458``` 459int32_t OH_ArkUI_CustomDialog_SetImmersiveMode(ArkUI_CustomDialogOptions* options, ArkUI_ImmersiveMode immersiveMode) 460``` 461 462**描述:** 463 464 465设置嵌入式弹窗蒙层的显示区域。 466 467**起始版本:** 19 468 469 470**参数:** 471 472| 参数项 | 描述 | 473| -- | -- | 474| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 指向自定义弹窗options的指针。 | 475| [ArkUI_ImmersiveMode](capi-native-dialog-h.md#arkui_immersivemode) immersiveMode | 显示区域类型的枚举值, 类型为[ArkUI_ImmersiveMode](capi-native-dialog-h.md#arkui_immersivemode)。 | 476 477**返回:** 478 479| 类型 | 说明 | 480| -- | -- | 481| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 482 483### OH_ArkUI_CustomDialog_SetBackgroundColor() 484 485``` 486int32_t OH_ArkUI_CustomDialog_SetBackgroundColor(ArkUI_CustomDialogOptions* options, uint32_t backgroundColor) 487``` 488 489**描述:** 490 491 492设置弹窗的背景颜色。 493 494**起始版本:** 19 495 496 497**参数:** 498 499| 参数项 | 描述 | 500| -- | -- | 501| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 502| uint32_t backgroundColor | 弹窗背景颜色。 | 503 504**返回:** 505 506| 类型 | 说明 | 507| -- | -- | 508| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 509 510### OH_ArkUI_CustomDialog_SetCornerRadius() 511 512``` 513int32_t OH_ArkUI_CustomDialog_SetCornerRadius(ArkUI_CustomDialogOptions* options, float topLeft, float topRight, float bottomLeft, float bottomRight) 514``` 515 516**描述:** 517 518 519设置弹窗的圆角半径。 520 521**起始版本:** 19 522 523 524**参数:** 525 526| 参数项 | 描述 | 527| -- | -- | 528| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 529| float topLeft | 弹窗左上角的圆角半径。 | 530| float topRight | 弹窗右上角的圆角半径。 | 531| float bottomLeft | 弹窗左下角的圆角半径。 | 532| float bottomRight | 弹窗右下角的圆角半径。 | 533 534**返回:** 535 536| 类型 | 说明 | 537| -- | -- | 538| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 539 540### OH_ArkUI_CustomDialog_SetBorderWidth() 541 542``` 543int32_t OH_ArkUI_CustomDialog_SetBorderWidth(ArkUI_CustomDialogOptions* options, float top, float right, float bottom, float left, ArkUI_LengthMetricUnit unit) 544``` 545 546**描述:** 547 548 549设置弹窗的边框宽度。 550 551**起始版本:** 19 552 553 554**参数:** 555 556| 参数项 | 描述 | 557| -- | -- | 558| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 559| float top | 弹窗上边框的宽度。 | 560| float right | 弹窗右边框的宽度。 | 561| float bottom | 弹窗下边框的宽度。 | 562| float left | 弹窗左边框的宽度。 | 563| [ArkUI_LengthMetricUnit](capi-native-type-h.md#arkui_lengthmetricunit) unit | 指定宽度的单位,默认为vp。 | 564 565**返回:** 566 567| 类型 | 说明 | 568| -- | -- | 569| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 570 571### OH_ArkUI_CustomDialog_SetBorderColor() 572 573``` 574int32_t OH_ArkUI_CustomDialog_SetBorderColor(ArkUI_CustomDialogOptions* options, uint32_t top, uint32_t right, uint32_t bottom, uint32_t left) 575``` 576 577**描述:** 578 579 580设置弹窗的边框颜色。 581 582**起始版本:** 19 583 584 585**参数:** 586 587| 参数项 | 描述 | 588| -- | -- | 589| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 590| uint32_t top | 弹窗上边框的颜色。 | 591| uint32_t right | 弹窗右边框的颜色。 | 592| uint32_t bottom | 弹窗下边框的颜色。 | 593| uint32_t left | 弹窗左边框的颜色。 | 594 595**返回:** 596 597| 类型 | 说明 | 598| -- | -- | 599| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 600 601### OH_ArkUI_CustomDialog_SetBorderStyle() 602 603``` 604int32_t OH_ArkUI_CustomDialog_SetBorderStyle(ArkUI_CustomDialogOptions* options, int32_t top, int32_t right, int32_t bottom, int32_t left) 605``` 606 607**描述:** 608 609 610设置弹窗的边框样式。 611 612**起始版本:** 19 613 614 615**参数:** 616 617| 参数项 | 描述 | 618| -- | -- | 619| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 620| int32_t top | 弹窗上边框的样式。 | 621| int32_t right | 弹窗右边框的样式。 | 622| int32_t bottom | 弹窗下边框的样式。 | 623| int32_t left | 弹窗左边框的样式。 | 624 625**返回:** 626 627| 类型 | 说明 | 628| -- | -- | 629| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 630 631### OH_ArkUI_CustomDialog_SetWidth() 632 633``` 634int32_t OH_ArkUI_CustomDialog_SetWidth(ArkUI_CustomDialogOptions* options, float width, ArkUI_LengthMetricUnit unit) 635``` 636 637**描述:** 638 639 640设置弹窗的背板宽度。 641 642**起始版本:** 19 643 644 645**参数:** 646 647| 参数项 | 描述 | 648| -- | -- | 649| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 650| float width | 弹窗的背板宽度。 | 651| [ArkUI_LengthMetricUnit](capi-native-type-h.md#arkui_lengthmetricunit) unit | 指定宽度的单位,默认为vp。 | 652 653**返回:** 654 655| 类型 | 说明 | 656| -- | -- | 657| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 658 659### OH_ArkUI_CustomDialog_SetHeight() 660 661``` 662int32_t OH_ArkUI_CustomDialog_SetHeight(ArkUI_CustomDialogOptions* options, float height, ArkUI_LengthMetricUnit unit) 663``` 664 665**描述:** 666 667 668设置弹窗的背板高度。 669 670**起始版本:** 19 671 672 673**参数:** 674 675| 参数项 | 描述 | 676| -- | -- | 677| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 678| float height | 弹窗的背板高度。 | 679| [ArkUI_LengthMetricUnit](capi-native-type-h.md#arkui_lengthmetricunit) unit | 指定高度的单位,默认为vp。 | 680 681**返回:** 682 683| 类型 | 说明 | 684| -- | -- | 685| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 686 687### OH_ArkUI_CustomDialog_SetShadow() 688 689``` 690int32_t OH_ArkUI_CustomDialog_SetShadow(ArkUI_CustomDialogOptions* options, ArkUI_ShadowStyle shadow) 691``` 692 693**描述:** 694 695 696设置弹窗的背板阴影。 697 698**起始版本:** 19 699 700 701**参数:** 702 703| 参数项 | 描述 | 704| -- | -- | 705| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 706| [ArkUI_ShadowStyle](capi-native-type-h.md#arkui_shadowstyle) shadow | 弹窗的背板阴影样式,枚举值。 | 707 708**返回:** 709 710| 类型 | 说明 | 711| -- | -- | 712| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 713 714### OH_ArkUI_CustomDialog_SetCustomShadow() 715 716``` 717int32_t OH_ArkUI_CustomDialog_SetCustomShadow(ArkUI_CustomDialogOptions* options, const ArkUI_AttributeItem* customShadow) 718``` 719 720**描述:** 721 722 723设置弹窗的背板阴影。 724 725**起始版本:** 19 726 727 728**参数:** 729 730| 参数项 | 描述 | 731| -- | -- | 732| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 733| [const ArkUI_AttributeItem](capi-arkui-nativemodule-arkui-attributeitem.md)* customShadow | 弹窗的自定义阴影参数,格式与[ArkUI_NodeAttributeType](./capi-native-node-h.md#arkui_nodeattributetype)中的NODE_CUSTOM_SHADOW属性一致。 | 734 735**返回:** 736 737| 类型 | 说明 | 738| -- | -- | 739| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 740 741### OH_ArkUI_CustomDialog_SetBackgroundBlurStyle() 742 743``` 744int32_t OH_ArkUI_CustomDialog_SetBackgroundBlurStyle(ArkUI_CustomDialogOptions* options, ArkUI_BlurStyle blurStyle) 745``` 746 747**描述:** 748 749 750设置弹窗的背板模糊材质。 751 752**起始版本:** 19 753 754 755**参数:** 756 757| 参数项 | 描述 | 758| -- | -- | 759| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 760| [ArkUI_BlurStyle](capi-native-type-h.md#arkui_blurstyle) blurStyle | 弹窗的背板模糊材质,枚举值。 | 761 762**返回:** 763 764| 类型 | 说明 | 765| -- | -- | 766| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 767 768### OH_ArkUI_CustomDialog_SetAlignment() 769 770``` 771int32_t OH_ArkUI_CustomDialog_SetAlignment(ArkUI_CustomDialogOptions* options, int32_t alignment, float offsetX, float offsetY) 772``` 773 774**描述:** 775 776 777设置弹窗的对齐模式。 778 779**起始版本:** 19 780 781 782**参数:** 783 784| 参数项 | 描述 | 785| -- | -- | 786| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 787| int32_t alignment | 弹窗的对齐模式,参数类型[ArkUI_Alignment](capi-native-type-h.md#arkui_alignment)。 | 788| float offsetX | 弹窗的水平偏移量,浮点型。 | 789| float offsetY | 弹窗的垂直偏移量,浮点型。 | 790 791**返回:** 792 793| 类型 | 说明 | 794| -- | -- | 795| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 796 797### OH_ArkUI_CustomDialog_SetModalMode() 798 799``` 800int32_t OH_ArkUI_CustomDialog_SetModalMode(ArkUI_CustomDialogOptions* options, bool isModal) 801``` 802 803**描述:** 804 805 806设置自定义弹窗是否开启模态样式的弹窗。 807 808**起始版本:** 19 809 810 811**参数:** 812 813| 参数项 | 描述 | 814| -- | -- | 815| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 816| bool isModal | 设置是否开启模态窗口。模态窗口有蒙层,非模态窗口无蒙层。设置为true表示开启模态窗口。设置为false表示关闭模态窗口。<br/>默认值:false | 817 818**返回:** 819 820| 类型 | 说明 | 821| -- | -- | 822| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 823 824### OH_ArkUI_CustomDialog_SetAutoCancel() 825 826``` 827int32_t OH_ArkUI_CustomDialog_SetAutoCancel(ArkUI_CustomDialogOptions* options, bool autoCancel) 828``` 829 830**描述:** 831 832 833设置自定义弹窗是否允许点击遮罩层退出。 834 835**起始版本:** 19 836 837 838**参数:** 839 840| 参数项 | 描述 | 841| -- | -- | 842| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 843| bool autoCancel | 设置是否允许点击遮罩层退出,true表示关闭弹窗,false表示不关闭弹窗。<br/>默认值:ture | 844 845**返回:** 846 847| 类型 | 说明 | 848| -- | -- | 849| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 850 851### OH_ArkUI_CustomDialog_SetSubwindowMode() 852 853``` 854int32_t OH_ArkUI_CustomDialog_SetSubwindowMode(ArkUI_CustomDialogOptions* options, bool showInSubwindow) 855``` 856 857**描述:** 858 859 860设置弹窗是否在子窗口显示此弹窗。 861 862**起始版本:** 19 863 864 865**参数:** 866 867| 参数项 | 描述 | 868| -- | -- | 869| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 870| bool showInSubwindow | 设置弹窗需要显示在主窗口之外时,是否在子窗口显示此弹窗。默认false,弹窗显示在应用内,而非独立子窗口。值为true时,可以显示在主窗口外。 | 871 872**返回:** 873 874| 类型 | 说明 | 875| -- | -- | 876| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 877 878### OH_ArkUI_CustomDialog_SetMask() 879 880``` 881int32_t OH_ArkUI_CustomDialog_SetMask(ArkUI_CustomDialogOptions* options, uint32_t maskColor, const ArkUI_Rect* maskRect) 882``` 883 884**描述:** 885 886 887设置自定义弹窗遮罩属性。 888 889**起始版本:** 19 890 891 892**参数:** 893 894| 参数项 | 描述 | 895| -- | -- | 896| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 897| uint32_t maskColor | 弹窗的遮罩颜色,0xargb格式。 | 898| [const ArkUI_Rect](capi-arkui-nativemodule-arkui-rect.md)* maskRect | 遮蔽层区域范围的指针,遮蔽层区域内的事件不透传,在遮蔽层区域外的事件透传。参数类型[ArkUI_Rect](capi-arkui-nativemodule-arkui-rect.md)。 | 899 900**返回:** 901 902| 类型 | 说明 | 903| -- | -- | 904| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 905 906### OH_ArkUI_CustomDialog_SetKeyboardAvoidMode() 907 908``` 909int32_t OH_ArkUI_CustomDialog_SetKeyboardAvoidMode(ArkUI_CustomDialogOptions* options, ArkUI_KeyboardAvoidMode keyboardAvoidMode) 910``` 911 912**描述:** 913 914 915设置弹窗避让键盘的模式。 916 917**起始版本:** 19 918 919 920**参数:** 921 922| 参数项 | 描述 | 923| -- | -- | 924| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 925| [ArkUI_KeyboardAvoidMode](capi-native-type-h.md#arkui_keyboardavoidmode) keyboardAvoidMode | 键盘避让模式,枚举值。 | 926 927**返回:** 928 929| 类型 | 说明 | 930| -- | -- | 931| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 932 933### OH_ArkUI_CustomDialog_SetHoverModeEnabled() 934 935``` 936int32_t OH_ArkUI_CustomDialog_SetHoverModeEnabled(ArkUI_CustomDialogOptions* options, bool enabled) 937``` 938 939**描述:** 940 941 942设置弹窗是否响应悬停态。 943 944**起始版本:** 19 945 946 947**参数:** 948 949| 参数项 | 描述 | 950| -- | -- | 951| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 952| bool enabled | 是否响应悬停态,默认false。值为true时响应悬停态,值为false时不响应悬停态。 | 953 954**返回:** 955 956| 类型 | 说明 | 957| -- | -- | 958| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 959 960### OH_ArkUI_CustomDialog_SetHoverModeArea() 961 962``` 963int32_t OH_ArkUI_CustomDialog_SetHoverModeArea(ArkUI_CustomDialogOptions* options, ArkUI_HoverModeAreaType hoverModeAreaType) 964``` 965 966**描述:** 967 968 969设置悬停态下弹窗默认展示区域。 970 971**起始版本:** 19 972 973 974**参数:** 975 976| 参数项 | 描述 | 977| -- | -- | 978| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 979| [ArkUI_HoverModeAreaType](capi-native-type-h.md#arkui_hovermodeareatype) hoverModeAreaType | 悬停态区域,枚举值。 | 980 981**返回:** 982 983| 类型 | 说明 | 984| -- | -- | 985| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 986 987### OH_ArkUI_CustomDialog_RegisterOnWillDismissCallback() 988 989``` 990int32_t OH_ArkUI_CustomDialog_RegisterOnWillDismissCallback(ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(ArkUI_DialogDismissEvent* event)) 991``` 992 993**描述:** 994 995 996注册系统关闭自定义弹窗的监听事件。 997 998**起始版本:** 19 999 1000 1001**参数:** 1002 1003| 参数项 | 描述 | 1004| -- | -- | 1005| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 1006| void* userData | 用户自定义数据指针。 | 1007| callback | 监听自定义弹窗关闭的回调事件。<br> - event: 回调函数的入参,捕获关闭原因。 | 1008 1009**返回:** 1010 1011| 类型 | 说明 | 1012| -- | -- | 1013| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 1014 1015### OH_ArkUI_CustomDialog_RegisterOnWillAppearCallback() 1016 1017``` 1018int32_t OH_ArkUI_CustomDialog_RegisterOnWillAppearCallback(ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData)) 1019``` 1020 1021**描述:** 1022 1023 1024注册自定义弹窗显示动效前的监听事件。 1025 1026**起始版本:** 19 1027 1028 1029**参数:** 1030 1031| 参数项 | 描述 | 1032| -- | -- | 1033| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 1034| void* userData | 用户自定义数据指针。 | 1035| callback | 弹窗显示动效前的事件回调。 | 1036 1037**返回:** 1038 1039| 类型 | 说明 | 1040| -- | -- | 1041| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 1042 1043### OH_ArkUI_CustomDialog_RegisterOnDidAppearCallback() 1044 1045``` 1046int32_t OH_ArkUI_CustomDialog_RegisterOnDidAppearCallback(ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData)) 1047``` 1048 1049**描述:** 1050 1051 1052注册自定义弹窗弹出时的监听事件。 1053 1054**起始版本:** 19 1055 1056 1057**参数:** 1058 1059| 参数项 | 描述 | 1060| -- | -- | 1061| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 1062| void* userData | 用户自定义数据指针。 | 1063| callback | 弹窗弹出时的事件回调。 | 1064 1065**返回:** 1066 1067| 类型 | 说明 | 1068| -- | -- | 1069| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 1070 1071### OH_ArkUI_CustomDialog_RegisterOnWillDisappearCallback() 1072 1073``` 1074int32_t OH_ArkUI_CustomDialog_RegisterOnWillDisappearCallback(ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData)) 1075``` 1076 1077**描述:** 1078 1079 1080注册自定义弹窗退出动效前的监听事件。 1081 1082**起始版本:** 19 1083 1084 1085**参数:** 1086 1087| 参数项 | 描述 | 1088| -- | -- | 1089| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 1090| void* userData | 用户自定义数据指针。 | 1091| callback | 弹窗退出动效前的事件回调。 | 1092 1093**返回:** 1094 1095| 类型 | 说明 | 1096| -- | -- | 1097| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 1098 1099### OH_ArkUI_CustomDialog_RegisterOnDidDisappearCallback() 1100 1101``` 1102int32_t OH_ArkUI_CustomDialog_RegisterOnDidDisappearCallback(ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData)) 1103``` 1104 1105**描述:** 1106 1107 1108注册自定义弹窗消失时的监听事件。 1109 1110**起始版本:** 19 1111 1112 1113**参数:** 1114 1115| 参数项 | 描述 | 1116| -- | -- | 1117| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 1118| void* userData | 用户自定义数据指针。 | 1119| callback | 弹窗消失时的事件回调。 | 1120 1121**返回:** 1122 1123| 类型 | 说明 | 1124| -- | -- | 1125| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 1126 1127### OH_ArkUI_CustomDialog_GetState() 1128 1129``` 1130int32_t OH_ArkUI_CustomDialog_GetState(ArkUI_NativeDialogHandle handle, ArkUI_DialogState* state) 1131``` 1132 1133**描述:** 1134 1135 1136获取弹窗的状态。 1137 1138**起始版本:** 20 1139 1140 1141**参数:** 1142 1143| 参数项 | 描述 | 1144| -- | -- | 1145| [ArkUI_NativeDialogHandle](capi-arkui-nativemodule-arkui-nativedialog8h.md) handle | 指向自定义弹窗控制器的指针。 | 1146| [ArkUI_DialogState](capi-native-dialog-h.md#arkui_dialogstate)* state | 自定义弹窗的状态。 | 1147 1148**返回:** 1149 1150| 类型 | 说明 | 1151| -- | -- | 1152| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 1153 1154### OH_ArkUI_CustomDialog_SetBackgroundBlurStyleOptions() 1155 1156``` 1157int32_t OH_ArkUI_CustomDialog_SetBackgroundBlurStyleOptions(ArkUI_CustomDialogOptions* options, const ArkUI_AttributeItem* backgroundBlurStyleOptions) 1158``` 1159 1160**描述:** 1161 1162 1163设置弹窗的背景模糊效果。 1164 1165**起始版本:** 19 1166 1167 1168**参数:** 1169 1170| 参数项 | 描述 | 1171| -- | -- | 1172| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 1173| [const ArkUI_AttributeItem](capi-arkui-nativemodule-arkui-attributeitem.md)* backgroundBlurStyleOptions | 弹窗的背景模糊效果。参数[ArkUI_AttributeItem](capi-arkui-nativemodule-arkui-attributeitem.md)格式:<br> .value[0].i32 表示深浅色模式,取[ArkUI_ColorMode](capi-native-type-h.md#arkui_colormode)枚举值。<br> .value[1]?.i32 表示取色模式,取[ArkUI_AdaptiveColor](capi-native-type-h.md#arkui_adaptivecolor)枚举值。<br> .value[2]?.f32 表示模糊效果程度,取[0.0,1.0]范围内的值。<br> .value[3]?.u32 表示灰阶模糊参数,对黑色的提亮程度,有效值范围为[0,127]。<br> .value[4]?.u32 表示灰阶模糊参数,对白色的压暗程度,有效值范围为[0,127]。<br> .value[5]?.i32 表示模糊激活策略,取[ArkUI_BlurStyleActivePolicy](capi-native-type-h.md#arkui_blurstyleactivepolicy)枚举值。<br> .value[6]?.u32 表示窗口失焦后,窗口内控件模糊效果会被移除,此时控件背板的颜色,0xargb类型。 | 1174 1175**返回:** 1176 1177| 类型 | 说明 | 1178| -- | -- | 1179| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 1180 1181### OH_ArkUI_CustomDialog_SetBackgroundEffect() 1182 1183``` 1184int32_t OH_ArkUI_CustomDialog_SetBackgroundEffect(ArkUI_CustomDialogOptions* options, const ArkUI_AttributeItem* backgroundEffect) 1185``` 1186 1187**描述:** 1188 1189 1190设置弹窗的背景效果参数。 1191 1192**起始版本:** 19 1193 1194 1195**参数:** 1196 1197| 参数项 | 描述 | 1198| -- | -- | 1199| [ArkUI_CustomDialogOptions](capi-arkui-nativemodule-arkui-customdialogoptions.md)* options | 弹窗参数。 | 1200| [const ArkUI_AttributeItem](capi-arkui-nativemodule-arkui-attributeitem.md)* backgroundEffect | 弹窗的背景效果参数。参数[ArkUI_AttributeItem](capi-arkui-nativemodule-arkui-attributeitem.md)格式:<br> .value[0].f32 表示模糊半径,单位为vp。<br> .value[1]?.f32 表示饱和度。<br> .value[2]?.f32 表示亮度。<br> .value[3]?.u32 表示颜色,0xargb类型。<br> .value[4]?.i32 表示取色模式,取[ArkUI_AdaptiveColor](capi-native-type-h.md#arkui_adaptivecolor)枚举值。<br> .value[5]?.u32 表示灰阶模糊参数,对黑色的提亮程度,有效值范围为[0,127]。<br> .value[6]?.u32 表示灰阶模糊参数,对白色的压暗程度,有效值范围为[0,127]。<br> .value[7]?.i32 表示模糊激活策略,取[ArkUI_BlurStyleActivePolicy](capi-native-type-h.md#arkui_blurstyleactivepolicy)枚举值。<br> .value[8]?.u32 表示窗口失焦后,窗口内控件模糊效果会被移除,此时控件背板的颜色,0xargb类型。 | 1201 1202**返回:** 1203 1204| 类型 | 说明 | 1205| -- | -- | 1206| int32_t | 错误码。<br> [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) 成功。<br> [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) 函数参数异常。 | 1207 1208 1209