Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I was wondering is it possible to use drawText with an array so that it doesn't place each word onto of the other?
for(int count =0; count<2; count++) { canvas.drawText(words[count], x, y, paint); }//for
您需要更改xor y,因此:
x
y
for (int count = 0; count < words.length; count++) { canvas.drawText(words[count], x + 10 * count, y, paint); }
这里,word[0] 将绘制在 (x, y) 处,而 word[1] 将绘制在 (x + 10, y) 处。但是,这不是很健壮。它假定所有单词都是 10 像素宽。