写Android里怎么让程序实现在屏幕上输出一个循环方法里的字符串
就是类似于Java中用System.out.println方法,for(inti=0;i<10;i++){System.out.println(i);}类似这样的算法,在...
就是类似于Java中用System.out.println方法,
for(int i = 0; i < 10; i++){
System.out.println(i);
}
类似这样的算法,在Android里怎么实现啊? 展开
for(int i = 0; i < 10; i++){
System.out.println(i);
}
类似这样的算法,在Android里怎么实现啊? 展开
1个回答
展开全部
void android.graphics.Canvas.drawText(String text,float x,float y,Paint paint)
public void drawText (String text, float x, float y, Paint paint)
Since: API Level 1
Draw the text, with origin at (x,y), using the specified paint. The origin is interpreted based on the Align setting in the paint.
Parameters
text The text to be drawn
x The x-coordinate of the origin of the text being drawn
y The y-coordinate of the origin of the text being drawn
paint The paint used for the text (e.g. color, size, style)
用这个drawText方法,需要Canvas canvas,Paint paint两个对象,具体实现如下
for(int i = 0; i < 10; i++){
canvas.drawText (i,10,i*20,paint);
}
public void drawText (String text, float x, float y, Paint paint)
Since: API Level 1
Draw the text, with origin at (x,y), using the specified paint. The origin is interpreted based on the Align setting in the paint.
Parameters
text The text to be drawn
x The x-coordinate of the origin of the text being drawn
y The y-coordinate of the origin of the text being drawn
paint The paint used for the text (e.g. color, size, style)
用这个drawText方法,需要Canvas canvas,Paint paint两个对象,具体实现如下
for(int i = 0; i < 10; i++){
canvas.drawText (i,10,i*20,paint);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询