Kivy ScrollView - Not Scrolling(Kivy ScrollView - 不滚动)
问题描述
看起来是人们对 Kivy 的常见问题.我已经在 SO 上检查了其他问题是否存在同样的问题,但没有运气.
Looks like a common problem people have with Kivy. I've already checked other questions for the same problem here on SO but no luck.
我有一个容器BoxLayout:
class Cnt(BoxLayout):
pass
在 .kv 文件中,我有这样的内容:
In the .kv file I've got something like this:
<Cnt>:
orientation: 'vertical'
ScrollView:
size_hint: (1, .9)
StackLayout:
padding: 5
size_hint_y: None
id: content_layout
minimum_height: self.height
ARow:
ARow:
ARow:
ARow:
ARow:
ARow:
ARow:
ARow:
ARow:
ARow:
ARow:
ARow:
ARow:
ARow:
ARow:
BoxLayout:
size_hint: (1, .1)
Label:
text: 'A'
ARow 是一个带有 CheckBox 和 Label 的 BoxLayout.它有:
ARow is a BoxLayout with a CheckBox and a Label. It has:
size_hint: (1, None)
height: 40
据我了解,这是仅有的两件重要的事情可以对滚动产生影响.
As far as I understand these are the only two important things that could do something to the scrolling.
minimum_height: self.height 与我在 Python 代码中绑定 StackLayout 的 minimum_height 和 height 相同,如果我理解正确的话.
minimum_height: self.height is the same as if I would bind the minimum_height and height of the StackLayout in Python code if I understood it right.
推荐答案
改变
minimum_height: self.height
到
height: self.minimum_height
minimum_height
是根据所有孩子的需要计算的.您希望实际高度等于最小高度,即使它大于父级的高度(对于滚动,这正是您想要的).
The minimum_height
is what's calculated as needed for all the children. You want the actual height to be equal to the minimum height, even if it's larger than the parent's height (for scrolling, this is exactly what you want).
这篇关于Kivy ScrollView - 不滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Kivy ScrollView - 不滚动


- 如何使用PYSPARK从Spark获得批次行 2022-01-01
- 我如何透明地重定向一个Python导入? 2022-01-01
- 计算测试数量的Python单元测试 2022-01-01
- 使用 Cython 将 Python 链接到共享库 2022-01-01
- ";find_element_by_name(';name';)";和&QOOT;FIND_ELEMENT(BY NAME,';NAME';)";之间有什么区别? 2022-01-01
- CTR 中的 AES 如何用于 Python 和 PyCrypto? 2022-01-01
- 检查具有纬度和经度的地理点是否在 shapefile 中 2022-01-01
- 使用公司代理使Python3.x Slack(松弛客户端) 2022-01-01
- YouTube API v3 返回截断的观看记录 2022-01-01
- 我如何卸载 PyTorch? 2022-01-01