我想将kv文件中的单选按钮(带有组和文本标签的复选框)居中。我已将它们添加到ScrollView
中,但是这些小部件之间有很多空间。
代码:
ScrollView:
size_hint: (1, 1)
GridLayout:
cols: 1
padding: 0
spacing: 0, 0
size_hint: (1, None)
height: self.minimum_height
BoxLayout:
orientation: "horizontal"
size_hint_x: 0.60
spacing: 0
padding: 0
pos_hint: {"center_x": 0.5}
size_hint_y: None
CheckBox:
group: "notIdentReason"
Label:
text: "Sample rejected"
font_size: 24
color: 0, 0, 0, 1
BoxLayout:
orientation: "horizontal"
size_hint_x: 0.60
spacing: 0
padding: 0
pos_hint: {"center_x": 0.5}
size_hint_y: None
CheckBox:
group: "notIdentReason"
Label:
text: "Unsubtyping"
font_size: 24
color: 0, 0, 0, 1
BoxLayout:
orientation: "horizontal"
size_hint_x: 0.60
spacing: 0
padding: 0
pos_hint: {"center_x": 0.5}
size_hint_y: None
CheckBox:
group: "notIdentReason"
Label:
text: "Other"
font_size: 24
color: 0, 0, 0, 1
截屏:
如何删除单选按钮和标签之间的空间?谢谢。
答案 0 :(得分:1)
我认为关键是为您的minimum_size
和GridLayout
使用BoxLayouts
,并设置其子级CheckBox
和{{1} }。像这样:
Label