2017-05-17 102 views

回答

0

您只需將您的內容放入FloatLayout中,並將該按鈕作爲FloatLayout的另一個子項,並將其指示爲所需的大小和位置。

FloatLayout: 
    BoxLayout: 
     orientation: 'vertical' 
     Label: 
      text: '1' 
     Label: 
      text: '2' 
     Label: 
      text: '3' 
     Label: 
      text: '4' 


    Button: 
     size_hint: None, None 
     right: self.width and root.right - 200 
     y: 200 
     text: 'such button' 
+0

但是,kivy如何知道浮動佈局中的哪一個元素在另一個之上?部件是否依次放置在浮動佈局中,因此在您的情況下,首先將BoxLayout放置並且之後可能位於Button的頂部? – PalimPalim

+0

窗口小部件按照它們添加到父窗口的順序顯示(在kv中爲寫入順序),某些佈局(如BoxLayout)會阻止子窗口彼此重疊,FloatLayout不會。 – Tshirtman