Draw text with shadow on canvas - Blog Android

Saturday, 8 September 2012

Draw text with shadow on canvas

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.


Borneo08

About Borneo08

Author Description here.. Nulla sagittis convallis. Curabitur consequat. Quisque metus enim, venenatis fermentum, mollis in, porta et, nibh. Duis vulputate elit in elit. Mauris dictum libero id justo.

Subscribe to this Blog via Email :

More links

Related Posts Plugin for WordPress, Blogger...