loopeer / shadow

Deprecated because of the performance not fine. Android custom shadow view, can replace your CardView
1.37k stars 141 forks source link

动态设置背景颜色无效 #19

Closed zyyoona7 closed 5 years ago

zyyoona7 commented 6 years ago

通过

shadowView.setBackgroundClr(Color.BLACK);

设置背景颜色无效,设置背景没有更新画笔颜色

private fun updateBackgroundClr(bgColor:Int){
    //起作用
    bgPaint.color=bgColor
    invalidate()
}
elmliu commented 5 years ago

具体怎么改源码啊.. 我下载了zip包,编辑后尝试重新导入,但总是没法正常使用

zyyoona7 commented 5 years ago

@elmliu 在 ShadowView 的 41-46 行

    var backgroundClr: Int = 0
        set(value) {
            field = value
            invalidate()
        }

将 invalidate() 替换成我上面的 updateBackgroundClr(field) 方法就可以了