canvas中的优先级,.after最前,before最底,canvas中间,部件在布局下面
<RelativeWidget>:
# 画布之后
canvas.before:
Color:
# 白色
rgba:[1,1,1,1]
Rectangle:
pos:self.pos
# 最大布局
size:self.size
canvas:
Color:
# 红
rgba:[.5,.1,.1,1]
Rectangle:
pos:self.pos
size:300,300
# 之前
canvas.after:
Color:
# 绿
rgba:[.1,.5,.1,1]
Rectangle:
pos:200,200
size:300,300
Button:
text:'Button 0'
pos:100,100
size_hint:None,None
size:300,300
canvas.after:
Color:
# 灰
rgba:[.1,.1,.5,1]
Rectangle:
pos:self.pos
size:100,100