如何单独设置的文字字母颜色? [英] How to set color of text letters individually?

查看:177
本文介绍了如何单独设置的文字字母颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将如何让文本,以便每个字母在andengine GLES 2随机颜色?对于随机颜色我可以去

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?

推荐答案

每个字母必须是它自己的文本并随机设置每一项的颜色 - 只要做到这一点

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

这篇关于如何单独设置的文字字母颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆