- 通过设置负的margin值,移动组件位置,使其超出父组件范围。
Image($r(“app.media.io_user_portrait”))
.width(80)
.height(80)
.margin({ top: -50, left: 15 })
- 在List内部使用ListItem占位,包住超出的区域。
List() {
ListItem().height(40).selectable(false) // 占位组件
ListItem() { // 需要超出范围的组件
Image($r(“app.media.io_user_portrait”))
.width(80)
.height(80)
.margin({ top: -50, left: 15 })
}
…
}
实现步骤(另一种方式)
- 通过设置负的margin值,移动组件位置,使其超出父组件范围。
Image($r(“app.media.io_user_portrait”))
.width(80)
.height(80)
.margin({ top: -50, left: 15 })
- 在List组件外部使用Row占位,同时设置List.clip(false),允许滚动时上下溢出List组件的区域。
Row().height(60) // 占位组件
List() {
ListItem() { // 需要超出范围的组件
Image($r(“app.media.io_user_portrait”))
.width(80)
.hei