ListView 超出父区域 [英] ListView exceeding parent area
问题描述
我正在使用 ListView
并将其加载到 Rectangle
.向上或向下滚动内容时,内容未正确隐藏并且对用户仍然可见.有人可以帮我解决这个问题吗?
I'm using ListView
and I'm loading that onto a Rectangle
. While scrolling the content up or down the content is not correctly hidden and remains visible to the user. Can someone help me on this issue?
推荐答案
据 文档:
注意:视图不会自动启用剪辑.如果视图没有被其他项目或屏幕裁剪,则需要设置 clip: true 以便很好地裁剪视图外项目.
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
,即
Hence, what you are experiencing is a common behaviour and you should either 1) clip the view via other Item
s (e.g. a header Rectangle
and a footer Rectangle
with z:infinite
or simply set the clip
property to true
, i.e.
ListView{
//...
clip:true
//...
}
剪辑有一些性能劣势,这会极大地影响随着应用程序的增长.因此,应该仔细评估它的使用,尤其是在视图场景之外.
Clipping has some perfomance disavantages which can greatly affect the application as it grows. Hence, its usage, especially outside the views scenario, should be evaluated carefully.
这篇关于ListView 超出父区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!