簡體   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