若想居中显示,可采用以下方式:import promptAction from '@ohos.promptAction' let customDialogId: number = 0 @Builder function customDialogBuilder() { Column() { Text('提示信息').fontSize(30) Text('提示内容').fontSize(15) Row() { Button("确认").onClick(() => { promptAction.closeCustomDialog(customDialogId) }) } }.height(200).padding(10) } @Entry @Component struct Show { @State message: string = 'Hello World' build() { Row() { Column() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) .onClick(() => { promptAction.openCustomDialog({ builder: customDialogBuilder.bind(this) }).then((dialogId: number) => { customDialogId = dialogId }) }) } .width('100%') } .height('100%') } }
若想居中显示,可采用以下方式: