问题描述
我正在尝试使用ModalView
Canvas
顶点指令为Line
绘制阴影。即ModalView
的底部和左侧在打开时应具有轻微的阴影覆盖。我尝试调用ModalView
属性overlay_color
无效,并且Canvas
Line
顶点指令不能产生正确的效果。但是我似乎不能只画出阴影效果的底部和左侧边框。
<PopScrollModal>
on_open: app.root._is_modal_open = True
on_dismiss: app.root._is_modal_open = False
id: popscroll
auto_dismiss: True
orientation: 'vertical'
size_hint: (0.94,0.41)
border: [50,50,16,16]
overlay_color: [0.1,0.1,0.4]
pos_hint: {'top': 0.72}
background_normal: ''
background_color: (1,1,0)
background: 'white.png'
canvas:
Color:
rgba: app.theme_cls.bg_dark
RoundedRectangle:
size: self.size
pos: self.pos
radius: [7,]
canvas.after:
Color:
rgba: (0.2,0.2,0.4)
Line:
width: 1.
rounded_rectangle: (self.x,self.y,self.width,self.height,7)
RecycleView:
id: view_popscroll
viewclass: 'PopScrollBut'
pos_hint: {'top': 1}
size_hint: [1,0.99]
do_scroll_y: True
RecycleGridLayout:
cols: 1
spacing: 1
default_size: None,70
default_size_hint: 1,None
size_hint: 1,None
size: self.minimum_size
此行指令绘制在底部,但不遵循画布的半径:
canvas.after:
Color:
rgba: (0.2,0.4)
Line:
width: 1.
close: False
points: self.pos[0],self.pos[1],self.pos[0] + self.size[0],self.pos[1]]
Line
指令仅在ModalView
周围画一条线。
有人可以帮助您了解如何设置Points
以便它们只出现在左侧和底部还是以相同的方式设置overlay_color
?