Breaking News
Loading...
Saturday, 8 September 2012

Draw text with shadow on canvas

12:35
More examples of drawing on canvas of custom View listed HERE.

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);

};


Draw text with shadow on canvas


download filesDownload the files.


0 comments:

Post a Comment

 
Toggle Footer