Search code examples
kivymaterial-designscrollviewkivymd

Last Item added to Scrollview is cut


As Long as all the Items inside the Scrollview are smaler than the screen itself everything is fine, as soon as they get bigger the Last Item at the bottom is beeing cut in half and i cant scroll to see it propperly.

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)

Solution

  • Replace:

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

    with:

    height: self.minimum_height
    

    The function that you are trying to use is built in to the GridLayout.

    You should also set a specific height for each Button.