How to Draw TextView on Canvas in android..?
We have Canvas.DrawBitmap(), Canvas.drawText(). Do we have any Method in Canvas which takes Te
You can't draw a Textview directly, but you can put it in a layout and draw the layout. Something like this:
LinearLayout layout = new LinearLayout(context);
TextView textView = new TextView(context);
textView.setVisibility(View.VISIBLE);
textView.setText("Hello world");
layout.addView(textView);
layout.measure(canvas.getWidth(), canvas.getHeight());
layout.layout(0, 0, canvas.getWidth(), canvas.getHeight());
// To place the text view somewhere specific:
//canvas.translate(0, 0);
layout.draw(canvas);