首页 > 解决方案 > 如何调整 KivyMD 手风琴的大小

问题描述

问题:

我正在使用 KivyMD Accordion,它的高度占据了大部分 UI 空间并缩小了每个手风琴项中应该包含的其他小部件,如下图所示。

如何固定/设置手风琴的高度以占用更少的空间?感谢任何输入!

代码片段:

     MDAccordionItem:
        title: "HOME" 
        icon: 'key'
        GridLayout: # Root Layout of the screen
            rows:4

            ActionBar:
                pos_hint: {'top':1}
                ActionView:
                    use_separator: True
                    ActionPrevious:
                        title: 'Employee Info' 
                        with_previous: False

#-----------------CODE HERE FOR 2ND ACCORDION ITEM-------------------

在此处输入图像描述

标签: material-designkivykivy-language

解决方案


MDAccordionSubItem:之前添加GridLayout:

片段

 MDAccordionItem:
    title: "HOME" 
    icon: 'key'

    MDAccordionSubItem:
        GridLayout: # Root Layout of the screen
            rows:4

            ActionBar:
                pos_hint: {'top':1}
                ActionView:
                    use_separator: True
                    ActionPrevious:
                        title: 'Employee Info' #Nucleic Acid Extraction
                        with_previous: False

输出

图像01


推荐阅读