簡體   English   中英

添加到 Scrollview 的最后一個項目被剪切

[英]Last Item added to Scrollview is cut

只要滾動視圖中的所有項目都小於屏幕本身,一切都很好,一旦它們變大,底部的最后一個項目就會被切成兩半,我無法正確滾動查看它。

Kivy:

          GridLayout: 
                    
                ScrollView:
                    size_hint_y: None
                    pos_hint: {'x':self, 'y':self}
                    do_scroll_x: False
                    do_scroll_y: True 
                    size: root.width, root.height / 1.25 

                    GridLayout:           
                        cols:1
                        padding: 15 
                        spacing:10
                        height: sum(x.height for x in self.children)
                        size_hint_y:None
                        id: Zitate

Python:

btn = Button(text =  '\n"' + self.root.ids.Kommentar.text + '"' + "\n     ~" + self.root.ids.field.text + "\n", size_hint = (0.8 , None))

    self.root.ids.Zitate.add_widget(btn)

代替:

height: sum(x.height for x in self.children)

和:

height: self.minimum_height

您嘗試使用的 function 內置於GridLayout中。

您還應該為每個Button設置一個特定的height

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM