0

我不明白如何获得正确的间距。我需要第一个对象从顶部开始,并且我需要不要将单词捆绑在一起。

ScreenManager:
    id: screen_manager
    size_hint_y: 80
    Screen:
        name: 'Home'
    
        ScrollView:
            do_scroll_x: False
            do_scroll_y: True
            
            MDBoxLayout:
                cols: 1
                orientation: 'vertical'
                height: self.minimum_height
                size_hint_y: None
                scroll_type: ['bars', 'content']
                
                
                Image:
                    height: self.texture_size[1]
                    size_hint_y: None
                    keep_ratio: True                            
                    source: 'images/main.png'
                
                MDLabel:
                    size_hint_y: None
                    text: 'The Purest CBD'
                    halign: "center"
                    font_style: "H1"
                
                MDLabel:
                    size_hint_y: None
                    text: 'ThoughtCloud produces 100% organic, lab tested CBD oils made from hemp plants grown on licensed farms in the USA.'
                    halign: "center"
                    font_style: "H2"
                MDFlatButton:
                    text: "MDFLATBUTTON"
                    
                    
                Image:
                    height: self.texture_size[1]
                    size_hint_y: None
                    keep_ratio: True
                    allow_stretch: True
                    source: 'images/main.png'
                Image:
                    height: self.texture_size[1]
                    size_hint_y: None
                    keep_ratio: True
                    allow_stretch: True
                    source: 'images/main.png'
4

1 回答 1

0

您可以使用pos_hint它来确保您的小部件位于正确的位置。就像size_hint. 您可以给出从 0 到 1 的任何值,以将您的小部件放置在正确的位置

于 2021-01-12T03:27:21.503 回答