Search code examples
pythonkivykivymd

KivyMD always_scroll doesn't work, and whenever I scroll down It goes right back up


Hello guys I'm new to Kivy and the documentation was hell, so I am confused rn, Im making a cacao disease information app and always_scroll was already defined in my code but it still doesnt work. Can you help me? Thanks <#

ScrollView:
            id: scroll_view
            always_scroll: True
            MDFloatLayout:
                adaptive_height: True
                orientation:'vertical'
                MDLabel:
                    text: "DISEASE NAME"
                    font_name: "Raleway-Black.ttf"
                    font_size: 18
                    halign: "left"
                    pos_hint: {"center_y": .8}
                    theme_text_color: "Custom"
                    text_color: "#A08264"
                    padding:[10,0]
                    adaptive_height: True

                MDLabel:
                    text: "Vascular Streak Dieback"
                    font_name: "Raleway-Black.ttf"
                    font_size: 17
                    halign: "left"
                    pos_hint: {"center_y": .55}
                    theme_text_color: "Custom"
                    text_color: "#A08264"
                    padding:[20,0]
                MDBoxLayout:
                    size_hint: .95, None
                    height: '1dp'
                    pos_hint: {"center_y": .4, "center_x":.5}
                    padding: "0dp"
                    spacing: "0dp"
                    orientation: "vertical"
                    elevation: 0
                    md_bg_color:(0.627, 0.510, 0.392, 1.0)
                
                MDLabel:
                    text: "CAUSAL TYPE"
                    font_name: "Raleway-Black.ttf"
                    font_size: 18
                    halign: "left"
                    pos_hint: {"center_y": .24}
                    theme_text_color: "Custom"
                    text_color: "#A08264"
                    padding:[10,3]

                MDLabel:
                    text: "Fungi"
                    font_name: "Raleway-Black.ttf"
                    font_size: 16
                    halign: "left"
                    pos_hint: {"center_y": .01}
                    theme_text_color: "Custom"
                    text_color: "#A08264"
                    padding:[20,0]
                    adaptive_height: True

                MDBoxLayout:
                    size_hint: .95, None
                    height: '1dp'
                    pos_hint: {"center_y": -.15, "center_x":.5}
                    padding: "50dp"
                    spacing: "0dp"
                    orientation: "vertical"
                    elevation: 0
                    md_bg_color:(0.627, 0.510, 0.392, 1.0)

                MDLabel:
                    text: "CROP STAGE AFFECTED"
                    font_name: "Raleway-Black.ttf"
                    font_size: 18
                    halign: "left"
                    pos_hint: {"center_y": -.3}
                    theme_text_color: "Custom"
                    text_color: "#A08264"
                    padding:[10,0]
                    adaptive_height: True
                MDLabel:
                    text: "Pre-emergence, Seeding stage, Vegetative growing stage, Flowering stage, Fruiting stage"
                    font_name: "Raleway-Black.ttf"
                    font_size: 16
                    halign: "left"
                    pos_hint: {"center_y": -.65}
                    theme_text_color: "Custom"
                    text_color: "#A08264"
                    padding:[20,0]
                
                MDBoxLayout:
                    size_hint: .95, None
                    height: '1dp'
                    pos_hint: {"center_y": -.9, "center_x":.5}
                    spacing: "0dp"
                    orientation: "vertical"
                    elevation: 0
                    md_bg_color:(0.627, 0.510, 0.392, 1.0)
            
                MDLabel:
                    text: "CAUSAL TYPE"
                    font_name: "Raleway-Black.ttf"
                    font_size: 18
                    halign: "left"
                    pos_hint: {"center_y": -1.06}
                    theme_text_color: "Custom"
                    text_color: "#A08264"
                    padding:[10,0]
                    adaptive_height: True
                MDLabel:
                    text: "Leaves - discoloration and abnormal with necrotic area ,Stems - mold growth, bark discolorations and dieback , Roots - lesions with necrotic streaks, Whole plant - dwarfing"
                    font_name: "Raleway-Black.ttf"
                    font_size: 16
                    halign: "left"
                    pos_hint: {"center_y": -1.55     }
                    theme_text_color: "Custom"
                    text_color: "#A08264"
                    padding:[20,0]
                    adaptive_height: True

                MDBoxLayout:
                    size_hint: .95, None
                    height: '1dp'
                    pos_hint: {"center_y": -2, "center_x":.5}
                    spacing: "0dp"
                    orientation: "vertical"
                    elevation: 0
                    md_bg_color:(0.627, 0.510, 0.392, 1.0)
                MDLabel:
                    text: "SIGNS AND SYMPTOMS"
                    font_name: "Raleway-Black.ttf"
                    font_size: 18
                    halign: "left"
                    pos_hint: {"center_y": -2.15}
                    theme_text_color: "Custom"
                    text_color: "#A08264"
                    padding:[10,0]
                    adaptive_height: True
                
                MDLabel:
                    text: "Symptoms may vary from time to time, initially, chlorosis of the leaf may observed. Chlorosis may begin either at the tip or base of the leaf. Falling of leaves may observed in mid range."
                    font_name: "Raleway-Black.ttf"
                    font_size: 16
                    halign: "left"
                    pos_hint: {"center_y": -2.65}
                    theme_text_color: "Custom"
                    text_color: "#A08264"
                    padding:[20,0]
                    adaptive_height: True

Scroll works but it doesnt over scroll beyond the bounds of the content, It always go back up whenever I scroll down.


Solution

  • Instead of always_scroll = True try this:

    effect_cls: DampedScrollEffect
    

    This should allow you to scroll past the content. If this doesnt work the perhaps you meant

    always_overscroll: True
    

    Also noticed you have a double indentation after the first line which Im not sure is right :)