方案一、可以使用CustomPopupOptions的builder创建自定义气泡,@Builder中可以放自定义的内容。具体参考自定义气泡。
方案二、凸起的一部分可以理解成使用一个容器来覆盖底部容器,再对边框和背景做相应处理来达到需要的效果,子元素的堆叠可以使用Stack布局实现,具体实现方式如下:
代码如下:
@Entry
@Component
struct Page {
build() {
Column() {
Stack({ alignContent: Alignment.TopStart }) {
Column() {
}
.width(300)
.height(75)
.borderWidth(3)
.borderRadius(15);
Column() {
}
.width(20)
.height(20)
.borderWidth({ left: 3, top: 3 })
.backgroundColor(Color.White)
// 对组件进行平移和旋转
.margin({ top: -9, left: 40 })
.rotate({
x: 0,
y: 0,
z: 1,
centerX: '50%',
centerY: '50%',
angle: 45
});
};
}
.justifyContent(FlexAlign.Center)
.height('100%')
.width('100%');
}
}