如何将滚动视图应用于kivy中的框布局

2024-10-01 13:43:47 发布

您现在位置:Python中文网/ 问答频道 /正文

我有很多按钮,我想应用滚动视图框布局如下

<My Class>:
  ScrollView:
    BoxLayout:
      Button:
        text:"buttone1"
       Button:
        text:"buttone1"
       Button:
        text:"buttone1"
       Button:
        text:"buttone1"
       Button:
        text:"buttone1"
       Button:
        text:"buttone1"
       GridLayout:
         rows:4
         cols:4
         Button:
           text:"buttone1"
         Button:
           text:"buttone1"
         Button:
           text:"buttone1"
         Button:
           text:"buttone1"
         Button:
           text:"buttone1"

如何将Scrollview应用于上述内容


Tags: text内容mybutton布局按钮classrows
2条回答

将所有按钮和文本视图放在一个布局中,并将该布局放入ScrollView中。它应该是有效的

以下是我找到的最简单的解决方案:

ScrollView: GridLayout: id: glayout cols: 1 size_hint: (1, None) height: self.minimum_height Button: text:"button1" Button: text:"button2" Button: text:"button3" #Put content that you need in gridlayout

和13;
和13;

相关问题 更多 >