HarmonyOS Popup背景处理

如图是Popup实现的一个弹窗,箭头使用的是一张图,出现了一个白色背景,怎么去掉?

HarmonyOS Popup背景处理 -鸿蒙开发者社区

HarmonyOS
2025-01-09 17:07:19
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
aquaa

参考示例如下:

// xxx.ets
@Entry
@Component
struct PopupExample {
  @State handlePopup: boolean = false
  @State customPopup: boolean = false
  // popup构造器定义弹框内容
  @Builder
  popupBuilder() {
    Column() {
      Row() {
        Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceAround, alignItems: ItemAlign.Center }) {
          Text('回复').fontSize(15).fontColor(Color.White)
          Text('复制').fontSize(15).fontColor(Color.White)
          Text('删除').fontSize(15).fontColor(Color.White)
        }.width(200).height(50)
      }
      .backgroundColor(Color.Black)
      .borderRadius(8)

      Row() {
        Image($r('app.media.sanjiaoxing')).width(20).height(20)
      }
    }
    .backgroundColor('#00000000')
  }

  build() {
    Flex({ direction: FlexDirection.Column }) {
      Button('CustomPopupOptions')
        .position({ x: 100, y: 200 })
        .onClick(() => {
          this.customPopup = !this.customPopup
        })
        .bindPopup(this.customPopup, {
          enableArrow: false,
          builder: this.popupBuilder, // 气泡的内容
          placement: Placement.Top, // 气泡的弹出位置
          maskColor: Color.Transparent,
          popupColor: Color.Transparent, // 气泡的背景色
          backgroundBlurStyle: BlurStyle.NONE,
          radius: 0,
          targetSpace: 0,
          shadow: {
            radius: 0
          },
          onStateChange: (e) => {
            console.info(JSON.stringify(e.isVisible))
            if (!e.isVisible) {
              this.customPopup = false
            }
          }
        })
    }.width('100%')
    .backgroundColor(Color.Orange)
  }
}
分享
微博
QQ
微信
回复
2025-01-09 19:04:36
相关问题
HarmonyOS Popup宽度问题
251浏览 • 1回复 待解决
HarmonyOS 页面如何将背景处理为透明
365浏览 • 1回复 待解决
HarmonyOS popup宽度自适应
263浏览 • 1回复 待解决
HarmonyOS 子窗口弹出popup问题
278浏览 • 1回复 待解决
HarmonyOS Popup气泡支持边框问题
273浏览 • 1回复 待解决
HarmonyOS Popup会拦截页面点击事件
256浏览 • 1回复 待解决
HarmonyOS 自定义Popup arrow颜色怎么设置
186浏览 • 1回复 待解决
popup组件气泡框指向颜色怎么修改?
7597浏览 • 1回复 待解决
如何自定义popup弹窗的布局?
682浏览 • 2回复 待解决