我有一个带有按钮的GridLayout和一个要在按钮内部显示的图像。当我运行我的应用程序时,按钮中的图像有时居中,有时不居中。为什么?我相信它应该始终居中。
.kv文件:
MyLayout:
cols: 2
height: self.minimum_height
pos: root.pos
Button:
size_hint_y: None
height: self.parent.width/2
Image:
source: 'Images/employee/userprofile.png'
size: self.parent.size
center_x: self.parent.center_x
center_y: self.parent.center_y
下面的图片是我每次都会想到的:
这就是我有时会得到的:
https://stackoverflow.com/questions/44680645
复制