Problem with Kivy when trying to scrolldown vertical ScrollView with an horizontal ScrollView inside

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 10:07:25

I can't claim to understand this situation completely, but it seems that vertical ScrollView inside another vertical ScrollView works. So, a work around is to make the ScrollView inside your Custom class to allow vertical scrolling (along with the horizontal scrolling). To do this, change the kv for the ScrollView inside Custom to:

ScrollView:
    size_hint: 1, None
    height: 150
    do_scroll: True, True  # allow vertical scrolling also

    on_scroll_start: print('scrolling. but why?')
    GridLayout:
        id: grid
        size_hint: None, 1.01   # height must be slightly greater than ScrollView height
        width: self.minimum_width

In order for the vertical scrolling to work in the above, the height of the GridLayout must be larger than the height of the ScrollView, thus the 1.01 size hint.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!