空白白色 space 重叠来自 MDToolbar 的 KivyMD ImageList

Blank White space overlapping KivyMD ImageList from MDToolbar

我正在练习 KivyMD ImageList,图像列表被来自 MDBottomAppbar 的空白 space 覆盖。

这是它的样子:

请问如何删除 MDBottomAppbar 上方的白色空白 space 和重叠的图像列表。这是我的代码。提前致谢!

from kivymd.app import MDApp
from kivy.lang.builder import Builder
from kivy.core.window import Window

Window.size = (330, 500)


kv = '''
<MyTile@SmartTileWithLabel>
    size_hint_y: None
    height: "240dp"

BoxLayout:
    orientation: "vertical"
    md_bg_color: (240/255, 240/255, 240/255, 1)

    MDToolbar:
        id: success_screen_toolbar
        title: "Project"
        right_action_items: [["progress-check", lambda x: x]]


    ScrollView:

        size_hint_y: None
        size: "280dp", "360dp"
        pos_hint: {"center_x": .5, "center_y": .6}
        height: root.height - success_screen_toolbar.height - dp(90)
        y: root.height - success_screen_toolbar.height - dp(50)
        elevation: 8


        MDGridLayout:
            cols: 1
            adaptive_height: True
            padding: dp(4), dp(4)
            spacing: dp(4)

            MyTile:
                source: "C:/Users/HP USER/Downloads/bella_baron.jpg"
                text: "[size=26]Cat 1[/size]\n[size=14]cat-1.jpg[/size]"

            MyTile:
                source: "C:/Users/HP USER/Downloads/bella_baron.jpg"
                text: "[size=26]Cat 2[/size]\n[size=14]cat-2.jpg[/size]"
                tile_text_color: app.theme_cls.accent_color

            MyTile:
                source: "C:/Users/HP USER/Downloads/bella_baron.jpg"
                text: "[size=26][color=#ffffff]Cat 3[/color][/size]\n[size=14]cat-3.jpg[/size]"
                tile_text_color: app.theme_cls.accent_color


    MDBottomAppBar:
        MDToolbar:
            id: success_screen_bottomappbar
            icon: "magnify"
            on_action_button: x 
            type: 'bottom'
            mode: 'center'
            elevation: '8dp'
            left_action_items: [["calendar-text", lambda x: x], ["account-group", lambda x: x]]
            right_action_items: [["magnify", lambda x: x], ["menu", lambda x: x]]

'''

class Main(MDApp):
    def build(self):
        return Builder.load_string(kv)


Main().run()

请使用以下内容,我更改了您代码中的一些内容和一些主要小部件,因为它们添加了未被使用的额外 space,这导致了白色 space应用程序的主体,这里是 jbsidis 的代码:

from kivymd.app import MDApp
from kivy.lang.builder import Builder
from kivy.core.window import Window
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.floatlayout import FloatLayout

Window.size = (330, 500)


kv = '''
#:import MDTextField kivymd.uix.textfield.MDTextField
<MyTile@SmartTileWithLabel>
    size_hint_y: None
    height: "240dp"

<S>:
    MDTextFieldRound:
        pos_hint: {"center_x": .5, "center_y": .95}
        normal_color : [1,1,1,.1]
        color_active : [1,1,1,1]
        size_hint: .8, .07
        hint_text : 'Search a product...'
        icon_left : 'magnify'

Screen:
    FloatLayout:
        BoxLayout:
            id: m5
            pos_hint: {"center_x": .5, "center_y": .371} #this will change if you change this Window.size = (330, 500)
            orientation: "vertical"

            ScrollView:
                MDGridLayout:
                    cols: 1
                    adaptive_height: True
                    padding: dp(4), dp(4)
                    spacing: dp(4)

                    MyTile:
                        source: "Photos/pro.jpg"
                        text: "[size=26]jbsidis[/size]\n[size=14]cat-1.jpg[/size]"

                    MyTile:
                        source: "Photos/pro.jpg"
                        text: "[size=26]jbsidis[/size]\n[size=14]cat-2.jpg[/size]"
                        tile_text_color: app.theme_cls.accent_color

                    MyTile:
                        source: "Photos/pro.jpg"
                        text: "[size=26][color=#ffffff]jbsidis[/color][/size]\n[size=14]cat-3.jpg[/size]"
                        tile_text_color: app.theme_cls.accent_color


                    MyTile:
                        source: "a11.png"
                        text: ""
                        tile_text_color: [0,0,0,0]
                        FloatLayout:
                            AnchorLayout:
                                pos_hint: {"center_x": .5, "center_y": .9}
                                MDTextButton:
                                    halign: "center"
                                    text: "\n\n\n\n\n\n\nLoading more...\n\n"
                                MDSpinner:
                                    size_hint: .1,.1

    MDToolbar:
        id: success_screen_toolbar
        title: "Project"
        pos_hint: {"top": 1}
        right_action_items: [["progress-check", lambda: print(6)]]


    MDBottomAppBar:
        MDToolbar:
            id: success_screen_bottomappbar
            icon: "magnify"
            on_action_button: root.add_widget(app.sbar())
            type: 'bottom'
            mode: 'center'
            #elevation: '8dp'
            left_action_items: [["calendar-text", lambda: print(6)], ["account-group", lambda: print(6)]]
            right_action_items: [["magnify", lambda: print(6)], ["menu", lambda: print(6)]]

'''

class blanks1(BoxLayout):
    pass
class S(FloatLayout):
    pass


class Main(MDApp):
    def build(self):
        return Builder.load_string(kv)
    def sbar(self):
        self.root.ids.success_screen_toolbar.md_bg_color=[1,1,1,1]
        return S()


Main().run()

我还添加了当我们按下底部栏的放大镜图标时在顶部添加搜索栏的功能,我在图片底部添加了一个空图像,这样你就可以显示你的应用程序正在加载更多结果,希望这对你和大家有帮助,来自萨尔瓦多的问候,图片(别的,a11.png图片是一个空白的透明png图片,最后一个应该是一个空图片来扩展滚动区域否则底部栏将隐藏它,这是大多数操作系统实现的东西,但我们无法知道,因为我们没有看到源代码,请观看我的 youtube 频道:https://www.youtube.com/channel/UCIMmPyY7XjWHk1AHlR_UdWQ ):