0
我定義自定義線圖來看,我想畫shadowLayerAndroid的自定義視圖setShadowLayer的onDraw遞歸調用
mFoldLinePaint.setStyle(Paint.Style.STROKE);
mFoldLinePaint.setPathEffect(null);
canvas.drawPath(mPath, mFoldLinePaint);
mFoldLinePaint.setShader(new LinearGradient(line.getPoint(0).fLineX, line.getPoint(0).fLineY, line.getPoint(line.getSize() - 1).fLineX, line.getPoint(line.getSize() - 1).fLineY, mFoldLineGradientLeftColor, mFoldLineGradientRightColor, Shader.TileMode.MIRROR));
setLayerType(LAYER_TYPE_SOFTWARE, null);
mFoldLinePaint.setShadowLayer(5, 5, -5, Color.BLACK);
然後我得到的問題
1.onDraw遞歸調用
2.Black顏色不工作(陰影層工作) 任何一個幫助我?
我發現setShader原因黑色不起作用 – shuabing
我發現我刪除此代碼setLayerType(LAYER_TYPE_SOFTWARE,null)的; onDraw()方法只需要調用一次! – shuabing