Kivy 中的 ScrollView 无法正常工作,在每次向下滚动时反弹并最终反弹回首页
ScrollView in Kivy not working properly, rebounding on each scroll down and finally bouncing back all the way to the top page
Kivy 中的 ScrollView 无法正常工作,每次向下滚动时都会反弹,最后会一直反弹到首页。如何使其稳定(KivyMD on windows 10)
from kivy.lang import Builder
from kivymd.app import MDApp
from kivymd.uix.label import MDLabel
from kivymd.font_definitions import theme_font_styles
KV = '''
Screen:
BoxLayout:
orientation: "vertical"
MDToolbar:
title: "MDLabel"
ScrollView:
MDList:
GridLayout:
id: box
cols:1
spacing:100
'''
class Test(MDApp):
def build(self):
creen = Builder.load_string(KV)
# Names of standard font styles.
for name_style in theme_font_styles[:-1]:
for i in range(0, 10):
creen.ids.box.add_widget(
MDLabel(
size=creen.ids.box.size,
text=f"{name_style} style",
halign="center",
font_style=name_style,
)
)
return creen
Test().run()
尝试添加:
size_hint_y: None
height: self.minimum_height
给你的 GridLayout
.
Kivy 中的 ScrollView 无法正常工作,每次向下滚动时都会反弹,最后会一直反弹到首页。如何使其稳定(KivyMD on windows 10)
from kivy.lang import Builder
from kivymd.app import MDApp
from kivymd.uix.label import MDLabel
from kivymd.font_definitions import theme_font_styles
KV = '''
Screen:
BoxLayout:
orientation: "vertical"
MDToolbar:
title: "MDLabel"
ScrollView:
MDList:
GridLayout:
id: box
cols:1
spacing:100
'''
class Test(MDApp):
def build(self):
creen = Builder.load_string(KV)
# Names of standard font styles.
for name_style in theme_font_styles[:-1]:
for i in range(0, 10):
creen.ids.box.add_widget(
MDLabel(
size=creen.ids.box.size,
text=f"{name_style} style",
halign="center",
font_style=name_style,
)
)
return creen
Test().run()
尝试添加:
size_hint_y: None
height: self.minimum_height
给你的 GridLayout
.