0
我有以下Kivy选项弹出Kivy弹出动态改变高度
s ='''
<OptionPopup>:
id: optionPopup
size_hint : (None,None)
width : min(0.95 * self.window.width, dp(500))
title: "Option Title"
height: content.height
BoxLayout:
id: content
orientation: 'vertical'
spacing: '5dp'
height: contentButtons.height + cancelButton.height
BoxLayout:
id: contentButtons
orientation: 'vertical'
spacing: '0dp'
height : self.minimum_height
SettingSpacer:
Button:
id:cancelButton
size_hint_y : None
height: '50dp'
text: "Back"
on_release: optionPopup._dismiss()
'''
Builder.load_string(s)
这个弹出在我的应用程序只存在一次,我会动态地添加按钮到optionPopup.ids["contentButtons"]
。含义contentButton
布局minimum_height
被更改。如何正确调整我父母Boxlayouts content
和PopUp窗口的大小? 以上kv
选项似乎做了正确的事情,像绑定optionPopup.height
到content.height
,但它不起作用?