当我运行下面的代码时,我无法滚动。我想滚动整个屏幕。我怎样才能做到这一点?from kivy.base import runTouchApp#kivy.require("1.8.0")from kivy.uix.floatlayout import FloatLayoutfrom kivy.lang import Builderfrom kivy.config import Configfrom kivy.uix.scrollview import ScrollViewfrom kivy.properties import StringPropertyConfig.set('graphics', 'window_state', 'maximized')Builder.load_string('''<ScrollableLabel>: FloatLayout: AsyncImage: source:'' #html here allow_stretch: True keep_ratio: False pos_hint: {"top": 1, 'right':1} size_hint: 1, 1 AsyncImage: source:'' #html here allow_stretch: True keep_ratio: True pos_hint: {"top": 1, 'right':0.13} size_hint: 0.15, 0.15 Label: color: [66/255,134/255,244/255,1] height: 40 font_size: 25 italic: 1 bold: 1 text: 'testing' pos_hint: {"top": 0.96, 'right': 0.24} size_hint: 0.1, 0.1 Label: color: [66/255,134/255,244/255,1] height: 40 font_size: 50 italic: 1 bold: 1 text: 'Testing\\nTesting1\\nTesting2\\nTesting3\\nTesting4' pos: root.x, root.y+25 size_hint: 0.1, 0.1''')class ScrollableLabel(ScrollView): text = StringProperty('')if __name__ == "__main__": runTouchApp(ScrollableLabel())所有的东西都显示,但滚动条没有。
2 回答
皈依舞
TA贡献1851条经验 获得超3个赞
我找到了答案。
首先,您必须进行设置,size_hint: (1, None)
以便您可以设置height: 40
确定可以滚动多长时间。
如果你没有设置多久,你可以这样设置: height: sum([c.height for c in self.children])
添加回答
举报
0/150
提交
取消