In my application I used canvas to draw the text. now I want to set the width of the draw text. I can set only x
, y
position. I can't set width and height.
My problem
update for example "India is my Country" or if any length text it goes outside of canvas that is outside of the background image. i want to print "India is
my country" if i set width mean i think it goes to next line
@Override
protected void onDraw(Canvas canvas1)
{
Paint paint = new Paint();
Bitmap myBitmap = BitmapFactory.decodeResource(getResources(),R.drawable.ban_background);
Bitmap resizeImage1=Bitmap.createScaledBitmap(myBitmap,590,350,false);
canvas1.drawColor(Color.BLACK);
canvas1.drawBitmap(resizeImage1,10,5, null);
paint.setStyle(Paint.Style.FILL);
paint.setAntiAlias(true);
paint.setTextSize(25);
paint.setColor(Color.BLUE);
paint.setFakeBoldText(true);
paint.setTextSize(20);
paint.setStyle(Paint.Style.FILL_AND_STROKE);
canvas1.drawText(CameraText, 100,175, paint);
}
}