ListView超出父区域

ListView exceeding parent area

我正在使用 ListView 并将其加载到 Rectangle。向上或向下滚动内容时,内容未正确隐藏并且对用户保持可见。有人可以帮我解决这个问题吗?

documentation报道:

Note: Views do not enable clip automatically. If the view is not clipped by another item or the screen, it will be necessary to set clip: true in order to have the out of view items clipped nicely.

因此,您遇到的是一种常见行为,您应该 1) 通过其他 Item 裁剪视图(例如页眉 Rectangle 和页脚 Rectangle z:infinite 或简单地将 clip 属性 设置为 true,即

ListView{
   //...
   clip:true
   //...
}

剪辑有一些 perfomance disavantages 会随着应用程序的增长而对其产生很大影响。因此,应该仔细评估它的使用,尤其是在视图场景之外。