我想在Android画布上画线,如下所示: 也就是说,我想画一条白色的线条和不同颜色的阴影效果。 我尝试过阴影层但得到不同的输出。这是我的代码:
private void drawLine(float lx, float ly, float x, float y, Paint paint) {
shadowPaint.setMaskFilter(new BlurMaskFilter(12f, BlurMaskFilter.Blur.NORMAL));
shadowPaint.setColor(Color.RED);
shadowPaint.setStrokeWidth(lineWidth*2);
mPaintCanvas.drawLine(lx,ly,x,y,shadowPaint);
paint.setColor(Color.WHITE);
mPaintCanvas.drawLine(lx,ly,x,y,paint);
last_x = x;
last_y = y;
postInvalidate();
}
你能给我该类的完整代码吗