HarmonyOS Popup气泡支持边框问题

需求场景:CoStudy app 中很多处引导及功能需要以气泡的方式展示

当前困难影响:目前HarmonyOS原生的popup 其他功能都可配置,但是没有找到描边的属性

HarmonyOS
2024-12-24 17:14:53
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
superinsect

Popup目前是不支持边框的,目前只能用阴影或者在没有箭头的情况下,用自定义气泡,给自定的row设置边框

// xxx.ets
@Entry
@Component
struct PopupExample {
  @State customPopup: boolean = false
  @State handlePopup: boolean = false
  build() {
    Column({ space: 100 }) {
      Button("popup")
        .margin({ top: 50 })
        .onClick(() => {
          this.customPopup = !this.customPopup
        })
        .bindPopup(this.customPopup, {
          message: "this is a popup",
          arrowHeight: 20, // 设置气泡箭头高度
          arrowWidth: 20, // 设置气泡箭头宽度
          radius: 20, // 设置气泡的圆角
          shadow: { radius: 5, color: Color.Blue }, // 设置气泡的阴影
          backgroundBlurStyle: BlurStyle.NONE,
        })

      Button('CustomPopupOptions')
        .onClick(() => {
          this.customPopup = !this.customPopup
        })
        .bindPopup(this.customPopup, {
          builder: this.popupBuilder,
          placement: Placement.Top,
          showInSubWindow: false,
          onStateChange: (e) => {
            if (!e.isVisible) {
              this.customPopup = false
            }
          },
          // 设置弹窗显示动效与退出动效为缩放动效
        })
        .position({ x: 80, y: 300 })
    }.width('100%')
  }

  @Builder
  popupBuilder() {
    Row() {
      Text('Custom Popup with transitionEffect').fontSize(10)
    }
    .height(50)
    .padding(5)
    .borderRadius(20)
    .borderStyle(BorderStyle.Solid)
    .borderWidth(3)
    .borderColor(Color.Blue)
  }
}
  • 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.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
分享
微博
QQ
微信
回复
2024-12-24 18:10:02
相关问题
popup组件气泡框指向颜色怎么修改?
7990浏览 • 1回复 待解决
HarmonyOS Popup宽度问题
625浏览 • 1回复 待解决
HarmonyOS 气泡背景颜色问题
517浏览 • 1回复 待解决
HarmonyOS 子窗口弹出popup问题
591浏览 • 1回复 待解决
HarmonyOS 气泡点击蒙层问题
932浏览 • 1回复 待解决
HarmonyOS 图片背景及边框圆角设置问题
2298浏览 • 1回复 待解决
HarmonyOS bindPopup自定义气泡问题
513浏览 • 1回复 待解决
HarmonyOS Popup背景处理
416浏览 • 1回复 待解决
HarmonyOS popup宽度自适应
679浏览 • 1回复 待解决
HarmonyOS 怎么设置圆形边框
726浏览 • 1回复 待解决