繁体   English   中英

如何在kivy中将Scroll VIew应用于Box Layout

[英]How to apply Scroll VIew to Box Layout in kivy

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

<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应用于以上内容

将所有按钮和textviews放置在SINGLE布局中,然后将该布局放置在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 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM