📜  kivymd 导航 - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:04.692000             🧑  作者: Mango

代码示例1
Screen:
    #MDNavigationLayout: #unknown class 
    ScreenManager:
        Screen:
            MDBoxLayout:
                orientation:'vertical'
                MDToolbar:
                    title:"Teacher Section"
                    left_action_items:[["menu",lambda x:nav_drawer.set_state("open")]]
                    right_action_items:[["magnify",lambda x:None]]
                    elevation:5
                MDScreen:
                    ScreenManager:
                        id:nestedsm
                        MDScreen:
                            name:"Screen1"
                            MDLabel:
                                text:"Screen1"
                        MDScreen:
                            name:"Screen2"
                            MDLabel:
                                text:"Screen2 jbsidis"

                Widget:
            MDNavigationDrawer:
                id: nav_drawer
                BoxLayout:
                    orientation: 'vertical'
                    padding: "8dp"
                    spacing: "8dp"
                    Image:
                        id: avatar
                        size_hint: (1,1)
                        source: "images/pro.jpg" #"images/kitten.png"
                    MDLabel:
                        text: "Bhushan Ghevde"
                        font_style: "Subtitle1"
                        size_hint_y: None
                        height: self.texture_size[1]
                    MDLabel:
                        text: "bhushanghevde15@gmail.com"
                        size_hint_y: None
                        font_style: "Caption"
                        height: self.texture_size[1]
                    ScrollView:
                        MDList:
                            id: md_list
                            OneLineIconListItem:
                                text: "Add Teacher"
                                on_release:
                                    nestedsm.current = 'Screen1'
                                    root.ids.nav_drawer.set_state(new_state='toggle', animation=True)
                                IconLeftWidget:
                                    icon: "face-profile"

                            OneLineIconListItem:
                                text: "Upload"
                                on_release:
                                    nestedsm.current = 'Screen2'
                                    root.ids.nav_drawer.set_state(new_state='toggle', animation=True)
                                IconLeftWidget:
                                    icon: "upload"