如何在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);
上一篇:获取联系人姓名给出的Android电话号码电话号码、姓名、联系人、Andr
下一篇:Android的 - Tabhost在Activity类工作工作、Android、Tabhost、Activity