Ι want to insert new line to my String to draw my Text on Canvas , but i cant figure it out , it is being drawn all the way horizontally. I tried using an XML resource and converting from integer. Also double backslash or forthslash. Nothing. Anything wrong with the canvas? Any help appreciated
private Paint myPaint;
private String myText;
myPaint = new Paint();
myPaint.setTextAlign(Paint.Align.CENTER);
myPaint.setTypeface(Typeface.DEFAULT_BOLD);
myPaint.setTextSize(25);
myText = "FIRST PART\nSECOND PART\nTHIRD PART\nFOURTH PART";
@Override
protected void onDraw(Canvas canvas) {
canvas.drawText(myText,canvas.getWidth()/2,canvas.getHeight()/3,myPaint);
}