我现在正在构建一个应用程序,我想在那里实现 MDBottomSheet,但是有一个问题:底部表总是有一些额外的空白空间。
这是它的样子:
我很确定您可以看到“取消”按钮后有空白区域,我不知道如何解决。
这是我的一些 Python 代码:
from kivymd.app import MDApp
from kivymd.uix.bottomsheet import MDListBottomSheet
class MainApp(MDApp):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def screen_switch(self, scr_name):
self.root.manager.current = scr_name
self.root.toolbar.title = scr_name.capitalize()
def open_bottom_sheet(self):
bottom_sheet_menu = MDListBottomSheet(radius_from="top", radius=15)
menu_items = [
("About the app", lambda x: self.screen_switch("About the app"), "help"),
("Leave a review", lambda x: self.screen_switch("Leave a review"), "email"),
("Cancel", lambda x: bottom_sheet_menu.dismiss(), "close")
]
for txt, func, icon in menu_items:
bottom_sheet_menu.add_item(txt, func, icon)
bottom_sheet_menu.open()
这是我的一些 Kivy 代码:
BoxLayout:
orientation: "vertical"
toolbar: toolbar
MDToolbar:
id: toolbar
type: "top"
title: "Plans"
right_action_items: [("dots-vertical", lambda y: app.open_bottom_sheet())]
提前致谢!