How to set color of text letters individually?

不问归期 提交于 2019-12-25 03:47:15

问题


How would I make text so that each letter is a random color in andengine GLES 2? For the random color I could go

int red = (int) (Math.random() * 254) + 1;
int green = (int) (Math.random() * 254) + 1;
int blue = (int) (Math.random() * 254) + 1;
Color pColor = new Color(red, green, blue);

but how can I set this to each letter individually?


回答1:


each letter would have to be it's own Text and set each one's color randomly - just do it

and when you create the Text, set the color to white on creation, then change it to your random color

BTW, there is no way (that I am aware of) to do it in a single Text



来源:https://stackoverflow.com/questions/15149881/how-to-set-color-of-text-letters-individually

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!