如何TextView的绘制在画布上的机器人..? [英] How to Draw TextView on Canvas in android..?
问题描述
如何在Android的TextView的画在画布上..?
How to Draw TextView on Canvas in android..?
我们有 Canvas.DrawBitmap()
, Canvas.drawText()
。我们有在画布这需要的TextView作为一个参数或显示TextView的画布?任何其他方法的任何方法
We have Canvas.DrawBitmap()
, Canvas.drawText()
. Do we have any Method in Canvas which takes TextView as a parameter or any other method to display TextView on Canvas?
其实,我在TextView中一个字母,我要做出的字母是在画布上绘制。
Actually, I have a alphabet in TextView and I have to make drawing on that alphabet which is in canvas.
请说明什么....谢谢您的合作。
Please suggest anything....Thanks for your cooperation
推荐答案
您不能得出一个TextView直接,但你可以把它放在一个布局和绘制布局。事情是这样的:
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);
这篇关于如何TextView的绘制在画布上的机器人..?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!