android - Creating a shadow around a canvas drawn shape? -
what steps required create shape e.g. rectangle shadow scratch using canvas? adding shadow layer paint used draw rectangle yielded no success. no need bitmap, needed set layer type layer_type_software original approach worked. public class testshapeshadow extends view { paint paint; public testshapeshadow(context context) { super(context); paint = new paint(paint.anti_alias_flag); paint.setshadowlayer(12, 0, 0, color.yellow); // important apis setlayertype(layer_type_software, paint); } @override protected void ondraw(canvas canvas) { canvas.drawrect(20, 20, 100, 100, paint); } }