.kv文件中的
当我在关闭面板后打开面板时,内容会增加并向下推动其余面板,当我再次关闭和打开面板时会占用更多空间。下面是我使用的代码
class PanelPage(Screen):
def __init__(self, **kwargs):
super().__init__(**kwargs)
layout = MDGridLayout()
layout.cols = 1
scrollview = ScrollView()
mdlist = MDList()
panel = MDExpansionPanel(icon='images/hair1.jpeg',
content=HairStyles(),
panel_cls=MDExpansionPanelOneLine(text='Hairs'))
mdlist.add_widget(panel)
panel1 = MDExpansionPanel(icon='images/hair2.png',
content=AfroHair(),
panel_cls=MDExpansionPanelOneLine(text='Afro'))
mdlist.add_widget(panel1)
scrollview.add_widget(mdlist)
layout.add_widget(scrollview)
self.add_widget(layout)
class WelcomePage(Screen):
pass
class HairStyles(Screen):
pass
class AfroHair(Screen):
pass
:
...
<HairStyles>:
size_hint_y:None
height: '100sp'
...
...
<AfroHair>:
size_hint_y:None
height: '100sp'
...