如何画在画布上的文字?画布、文字

由网友(花开不败春色常在丶)分享简介:我试图开发一个简单的饼图类机器人。现在,它可以利用标签和值的地图,绘制饼图。我还没有添加传奇的馅饼,这是我需要的地方附近小矩形文本在屏幕角落。任何帮助AP preciated,因为我是新来的Andr​​oid开发人员。谢谢你。i'm trying to develop a simple pie chart class...

我试图开发一个简单的饼图类机器人。现在,它可以利用标签和值的地图,绘制饼图。我还没有添加传奇的馅饼,这是我需要的地方附近小矩形文本在屏幕角落。任何帮助AP preciated,因为我是新来的Andr​​oid开发人员。谢谢你。

i'm trying to develop a simple pie chart class for android. For now, it can take a map of labels and values and draw the pie chart. I'm yet to add the legends for the pie, which is where i need to place the texts near small rectangles on the screen corner. Any help appreciated, since i'm new to Android dev. Thanks.

推荐答案

您必须使用Canvas类的方法的drawText

You will have to use the drawText method of the Canvas class.

Paint paint = new Paint(); 
canvas.drawPaint(paint); 
paint.setColor(Color.BLACK); 
paint.setTextSize(16); 
canvas.drawText("My Text", x, y, paint); 

下面是关于它的相关文件:

Here's the relevant documentation about it:

http://developer.android.com/reference/android/graphics/Canvas.html#drawText(java.lang.String,浮球,浮球,android.graphics.Paint)

阅读全文

相关推荐

最新文章