这个
BoxLayout
除非你另有指示,否则会尝试在孩子之间平均分配可用空间。那么,你的最高水平
盒子布局
在
Urlpup
类在
盒子布局
包含
TextInput
还有
Recommendations
小装置。通过限制水平方向的空间,可以减少这两个小部件之间的空间
盒子布局
.你可以通过指定高度来实现
盒子布局
,就像这样:
BoxLayout:
size_hint_y: None
height: 50
orientation: 'horizontal'
Spinner:
id: spinner
size_hint: 0.5, 1
pos_hint: { 'top' : 1 }
text: 'en'
values: 'en', 'fr', 'de', 'it'
SearchBar:
id: url_input
size_hint: 1, 1
pos_hint: { 'center_x' : 0.5, 'top' : 1 }
multiline: False
font_size: self.height*0.8
Button:
text: 'OK'
size_hint: 0.5, 1
pos_hint: { 'top' : 1 }
on_press: root.dismiss()
on_release: app.create_new_article(url_input.text)
请注意,这个
盒子布局
所有人都有一个
size_hint_y
属于
1.0
,因此它们都将是为其容器指定的高度。
这个
建议
小部件获取剩余的垂直空间(减去
spacing
).你可以移动
建议
通过减少
间距
.