2017-05-17 167 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