KivyMD - 为什么 MDList 只在屏幕的一半
KivyMD - why is the MDList just on half of the screen
我想使用 ButtonNavigation + MDList,但列表只能在半个屏幕上看到(见屏幕截图)。可以全屏显示列表吗?
<CreateScreen>
name: "create_screen"
BoxLayout:
orientation: "vertical"
ScrollView:
MDList:
TwoLineAvatarIconListItem:
id: list1
text: "Date"
secondary_text: "Time"
IconLeftWidget:
icon: "github"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
MDBottomNavigation:
MDBottomNavigationItem:
name: 'screen 1'
text: 'Back'
icon: "arrow-left"
on_tab_release: root.manager.current = "main_screen"
MDBottomNavigationItem:
name: 'screen 2'
text: 'ADD'
icon: "calendar-plus"
on_tab_release: root.create_new_date_picker()
Screenshot - List is just on half screen
你可以在每一个底部item下面添加内容就可以解决,也可以使用RecycleView优化内存,使用代码:
<CreateScreen>
name: "create_screen"
BoxLayout:
orientation: 'vertical'
#do not put the content of your screen or scrollview here,
#because the bottom toolbar has its own screen body
MDBottomNavigation:
MDBottomNavigationItem:
name: 'screen 1'
text: 'Back'
icon: "arrow-left"
#on_tab_release: root.manager.current = "main_screen"
ScrollView:
MDList:
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
canvas:
Color:
rgba: [0,1,0,.3]
Rectangle:
pos: self.pos
size: self.size
id: list1
text: "El Salvador"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
markup: True
text: "[i]New promotions"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
canvas:
Color:
rgba: [0,0,1,.3]
Rectangle:
pos: self.pos
size: self.size
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
MDBottomNavigationItem:
name: 'screen 2'
text: 'ADD'
icon: "calendar-plus"
#on_tab_release: root.create_new_date_picker()
ScrollView:
MDList:
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "star"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
canvas:
Color:
rgba: [0,1,0,.3]
Rectangle:
pos: self.pos
size: self.size
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "star"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "star"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
canvas:
Color:
rgba: [0,0,1,.3]
Rectangle:
pos: self.pos
size: self.size
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "star"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
图片如下:
我向 MDBottomNaviagtion 添加了以下内容
MDBottomNavigation:
height: self.minimum_height
size_hint: 1, 0.1
现在它只使用它需要的space。
我想使用 ButtonNavigation + MDList,但列表只能在半个屏幕上看到(见屏幕截图)。可以全屏显示列表吗?
<CreateScreen>
name: "create_screen"
BoxLayout:
orientation: "vertical"
ScrollView:
MDList:
TwoLineAvatarIconListItem:
id: list1
text: "Date"
secondary_text: "Time"
IconLeftWidget:
icon: "github"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
MDBottomNavigation:
MDBottomNavigationItem:
name: 'screen 1'
text: 'Back'
icon: "arrow-left"
on_tab_release: root.manager.current = "main_screen"
MDBottomNavigationItem:
name: 'screen 2'
text: 'ADD'
icon: "calendar-plus"
on_tab_release: root.create_new_date_picker()
Screenshot - List is just on half screen
你可以在每一个底部item下面添加内容就可以解决,也可以使用RecycleView优化内存,使用代码:
<CreateScreen>
name: "create_screen"
BoxLayout:
orientation: 'vertical'
#do not put the content of your screen or scrollview here,
#because the bottom toolbar has its own screen body
MDBottomNavigation:
MDBottomNavigationItem:
name: 'screen 1'
text: 'Back'
icon: "arrow-left"
#on_tab_release: root.manager.current = "main_screen"
ScrollView:
MDList:
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
canvas:
Color:
rgba: [0,1,0,.3]
Rectangle:
pos: self.pos
size: self.size
id: list1
text: "El Salvador"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
markup: True
text: "[i]New promotions"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
canvas:
Color:
rgba: [0,0,1,.3]
Rectangle:
pos: self.pos
size: self.size
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
MDBottomNavigationItem:
name: 'screen 2'
text: 'ADD'
icon: "calendar-plus"
#on_tab_release: root.create_new_date_picker()
ScrollView:
MDList:
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "star"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
canvas:
Color:
rgba: [0,1,0,.3]
Rectangle:
pos: self.pos
size: self.size
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "star"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "star"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
canvas:
Color:
rgba: [0,0,1,.3]
Rectangle:
pos: self.pos
size: self.size
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "star"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
TwoLineAvatarIconListItem:
id: list1
text: "jbsidis"
secondary_text: "Time"
IconLeftWidget:
icon: "pencil"
on_release: print("Hello")
IconRightWidget:
icon: "clock"
图片如下:
我向 MDBottomNaviagtion 添加了以下内容
MDBottomNavigation:
height: self.minimum_height
size_hint: 1, 0.1
现在它只使用它需要的space。