I want to draw a text in the SurfaceView look like the image given below
How can i do this. Please help me.
I want to draw a text in the SurfaceView look like the image given below
How can i do this. Please help me.
replace your onDraw( Canvas canvas ) method with the following code.
@Override
protected void onDraw(Canvas canvas)
{
canvas.drawColor( Color.WHITE );
int cx = 240; // screenWidth/2
int cy = 400; // screenHeight/2
Paint paint = new Paint();
paint.setTextSize(30);
paint.setColor( Color.BLACK );
paint.setAntiAlias(true);
canvas.drawText("Name: A", 20, 40, paint);
canvas.save();
canvas.rotate(180, 240, 400);
canvas.drawText("Name: B", 20, 40,paint);
canvas.restore();
}