Search code examples
kivykivy-languagekivymd

KivyMD - why is the MDList just on half of the screen


I want to use an ButtonNavigation + MDList, but the list is just to see on half of the screen (see screenshot). Have can I display the list on the whole screen?

<CreateScreen>
    name: "create_screen"
    BoxLayout:
        orientation: "vertical"
        ScrollView:
            MDList:
                TwoLineAvatarIconListItem:
                    id: list1
                    text: "Date"
                    secondary_text: "Time"
                    IconLeftWidget:
                        icon: "github"
                        on_release: print("Hello")
                    IconRightWidget:
                        icon: "clock"


        MDBottomNavigation:
            MDBottomNavigationItem:
                name: 'screen 1'
                text: 'Back'
                icon: "arrow-left"
                on_tab_release: root.manager.current = "main_screen"


            MDBottomNavigationItem:
                name: 'screen 2'
                text: 'ADD'
                icon: "calendar-plus"
                on_tab_release: root.create_new_date_picker()

Screenshot - List is just on half screen


Solution

  • You can add the content under every bottom item and that will fix it, you can also use RecycleView to optimize memory, use the code:

    <CreateScreen>
        name: "create_screen"
        BoxLayout:
            orientation: 'vertical'
            #do not put the content of your screen or scrollview here,
            #because the bottom toolbar has its own screen body
    
    
            MDBottomNavigation:
                MDBottomNavigationItem:
                    name: 'screen 1'
                    text: 'Back'
                    icon: "arrow-left"
                    #on_tab_release: root.manager.current = "main_screen"
                    ScrollView:
                        MDList:
                            TwoLineAvatarIconListItem:
                                id: list1
                                text: "jbsidis"
                                secondary_text: "Time"
                                IconLeftWidget:
                                    icon: "pencil"
                                    on_release: print("Hello")
                                IconRightWidget:
                                    icon: "clock"
                            TwoLineAvatarIconListItem:
                                canvas:
                                    Color:
                                        rgba: [0,1,0,.3]
                                    Rectangle:
                                        pos: self.pos
                                        size: self.size
                                id: list1
                                text: "El Salvador"
                                secondary_text: "Time"
                                IconLeftWidget:
                                    icon: "pencil"
                                    on_release: print("Hello")
                                IconRightWidget:
                                    icon: "clock"
                            TwoLineAvatarIconListItem:
                                id: list1
                                markup: True
                                text: "[i]New promotions"
                                secondary_text: "Time"
                                IconLeftWidget:
                                    icon: "pencil"
                                    on_release: print("Hello")
                                IconRightWidget:
                                    icon: "clock"
                            TwoLineAvatarIconListItem:
                                canvas:
                                    Color:
                                        rgba: [0,0,1,.3]
                                    Rectangle:
                                        pos: self.pos
                                        size: self.size
                                id: list1
                                text: "jbsidis"
                                secondary_text: "Time"
                                IconLeftWidget:
                                    icon: "pencil"
                                    on_release: print("Hello")
                                IconRightWidget:
                                    icon: "clock"
                            TwoLineAvatarIconListItem:
                                id: list1
                                text: "jbsidis"
                                secondary_text: "Time"
                                IconLeftWidget:
                                    icon: "pencil"
                                    on_release: print("Hello")
                                IconRightWidget:
                                    icon: "clock"
                            TwoLineAvatarIconListItem:
                                id: list1
                                text: "jbsidis"
                                secondary_text: "Time"
                                IconLeftWidget:
                                    icon: "pencil"
                                    on_release: print("Hello")
                                IconRightWidget:
                                    icon: "clock"
                            TwoLineAvatarIconListItem:
                                id: list1
                                text: "jbsidis"
                                secondary_text: "Time"
                                IconLeftWidget:
                                    icon: "pencil"
                                    on_release: print("Hello")
                                IconRightWidget:
                                    icon: "clock"
                            TwoLineAvatarIconListItem:
                                id: list1
                                text: "jbsidis"
                                secondary_text: "Time"
                                IconLeftWidget:
                                    icon: "pencil"
                                    on_release: print("Hello")
                                IconRightWidget:
                                    icon: "clock"
                            TwoLineAvatarIconListItem:
                                id: list1
                                text: "jbsidis"
                                secondary_text: "Time"
                                IconLeftWidget:
                                    icon: "pencil"
                                    on_release: print("Hello")
                                IconRightWidget:
                                    icon: "clock"
    
    
                MDBottomNavigationItem:
                    name: 'screen 2'
                    text: 'ADD'
                    icon: "calendar-plus"
                    #on_tab_release: root.create_new_date_picker()
                    ScrollView:
                        MDList:
                            TwoLineAvatarIconListItem:
                                id: list1
                                text: "jbsidis"
                                secondary_text: "Time"
                                IconLeftWidget:
                                    icon: "star"
                                    on_release: print("Hello")
                                IconRightWidget:
                                    icon: "clock"
                            TwoLineAvatarIconListItem:
                                canvas:
                                    Color:
                                        rgba: [0,1,0,.3]
                                    Rectangle:
                                        pos: self.pos
                                        size: self.size
                                id: list1
                                text: "jbsidis"
                                secondary_text: "Time"
                                IconLeftWidget:
                                    icon: "star"
                                    on_release: print("Hello")
                                IconRightWidget:
                                    icon: "clock"
                            TwoLineAvatarIconListItem:
                                id: list1
                                text: "jbsidis"
                                secondary_text: "Time"
                                IconLeftWidget:
                                    icon: "star"
                                    on_release: print("Hello")
                                IconRightWidget:
                                    icon: "clock"
                            TwoLineAvatarIconListItem:
                                canvas:
                                    Color:
                                        rgba: [0,0,1,.3]
                                    Rectangle:
                                        pos: self.pos
                                        size: self.size
                                id: list1
                                text: "jbsidis"
                                secondary_text: "Time"
                                IconLeftWidget:
                                    icon: "star"
                                    on_release: print("Hello")
                                IconRightWidget:
                                    icon: "clock"
                            TwoLineAvatarIconListItem:
                                id: list1
                                text: "jbsidis"
                                secondary_text: "Time"
                                IconLeftWidget:
                                    icon: "pencil"
                                    on_release: print("Hello")
                                IconRightWidget:
                                    icon: "clock"
                            TwoLineAvatarIconListItem:
                                id: list1
                                text: "jbsidis"
                                secondary_text: "Time"
                                IconLeftWidget:
                                    icon: "pencil"
                                    on_release: print("Hello")
                                IconRightWidget:
                                    icon: "clock"
                            TwoLineAvatarIconListItem:
                                id: list1
                                text: "jbsidis"
                                secondary_text: "Time"
                                IconLeftWidget:
                                    icon: "pencil"
                                    on_release: print("Hello")
                                IconRightWidget:
                                    icon: "clock"
                            TwoLineAvatarIconListItem:
                                id: list1
                                text: "jbsidis"
                                secondary_text: "Time"
                                IconLeftWidget:
                                    icon: "pencil"
                                    on_release: print("Hello")
                                IconRightWidget:
                                    icon: "clock"
                            TwoLineAvatarIconListItem:
                                id: list1
                                text: "jbsidis"
                                secondary_text: "Time"
                                IconLeftWidget:
                                    icon: "pencil"
                                    on_release: print("Hello")
                                IconRightWidget:
                                    icon: "clock"
    

    Here is the image:

    enter image description here