MDExpansionPanel内容正在自动增加



当我在关闭面板后打开面板时,内容会增加并向下推动其余面板,当我再次关闭和打开面板时会占用更多空间。下面是我使用的代码

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
.kv文件中的

...
<HairStyles>:
size_hint_y:None
height: '100sp'
...
...
<AfroHair>:
size_hint_y:None
height: '100sp'
...

相关内容

  • 没有找到相关文章

最新更新