To draw text with shadow on canvas, Modify onDraw(Canvas canvas) method of MyView.java in the exercise.
@Override
protected void onDraw(Canvas canvas) {
canvas.drawColor(Color.GRAY);
Paint shadowPaint = new Paint();
shadowPaint.setAntiAlias(true);
shadowPaint.setColor(Color.WHITE);
shadowPaint.setTextSize(45.0f);
shadowPaint.setStrokeWidth(2.0f);
shadowPaint.setStyle(Paint.Style.STROKE);
shadowPaint.setShadowLayer(5.0f, 10.0f, 10.0f, Color.BLACK);
canvas.drawText("http://android-er.blogspot.com/", 50, 200, shadowPaint);
};
Download the files.
4 comments:
Nice one. Thanks for the posting.
Thanks
Awesome. Thanks :)
Thanks, made a handy reference, not to mention the top google result for "android drawtext with drop shadow"!
Post a Comment