HarmonyOS 自定义底部弹窗 (CustomDialog)无法设置四角圆角

1、customStyle为true的时候,圆角默认变成了0,无法自定义圆角大小。

2、customStyle为false 的时候,可通过cornerRadius自定义四个方向圆角大小,但会显示在导航条的上方。

HarmonyOS 自定义底部弹窗 (CustomDialog)无法设置四角圆角 -鸿蒙开发者社区

HarmonyOS
2024-12-25 12:45:32
1.2w浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
zxjiu

参考示例:

import { ComponentContent, window } from '@kit.ArkUI';
import { BusinessError } from '@kit.BasicServicesKit';

@Builder
function buildText() {
  Column() {
    Text("这是一个弹框")
      .fontSize(20)
  }
  .width('100%')
  .height(200)
  .backgroundColor(Color.Red)
  .borderRadius({
    topLeft: 10,
    topRight: 10,
    bottomLeft: 40,
    bottomRight: 40
  })
}

@Entry
@Component
struct Parent {
  build() {
    Column() {
      Column() {
        Button("click").onClick(() => {
          let uiContext = this.getUIContext();
          let promptAction = uiContext.getPromptAction();
          let contentNode = new ComponentContent((uiContext as UIContext), wrapBuilder(buildText));
          try {
            promptAction.openCustomDialog(contentNode, {
              isModal: false,
            });
          } catch (error) {
            let message = (error as BusinessError).message;
            let code = (error as BusinessError).code;
            console.error(`OpenCustomDialog args error code is ${code}, message is ${message}`);
          }
          ;
        })
      }
    }
  }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
分享
微博
QQ
微信
回复
2024-12-25 15:29:50


相关问题
HarmonyOS 自定义弹窗CustomDialog
486浏览 • 1回复 待解决
HarmonyOS 自定义弹窗CustomDialog问题
1041浏览 • 1回复 待解决
HarmonyOS 自定义弹窗CustomDialog 问题
468浏览 • 1回复 待解决
HarmonyOS 自定义弹窗 (CustomDialog)问题
986浏览 • 1回复 待解决
HarmonyOS 全局自定义弹窗无法弹出
569浏览 • 1回复 待解决
HarmonyOS 如何设置自定义弹窗透明
542浏览 • 1回复 待解决
如何设置自定义弹窗位置
2474浏览 • 1回复 待解决
CustomDialog自定义动画
1016浏览 • 1回复 待解决