更改形状上的文本
你好 是否可以更改形状的文本?我有:
levelFraction = new Text(0, 300, mFont, "text", HorizontalAlign.CENTER);
然后我将其添加到场景中:
scene.getTopLayer().addEntity(levelFraction);
但我没有看到任何在运行时更改文本的方法。比如:
levelFraction.setText(...);
这可能吗?
Hi
is it possible to change the text of a shape? I have:
levelFraction = new Text(0, 300, mFont, "text", HorizontalAlign.CENTER);
then I add it to the scene:
scene.getTopLayer().addEntity(levelFraction);
but I don't see any method to change the text at runtime. Something like:
levelFraction.setText(...);
Is that possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您甚至可以根据 texteffect.text 的值调用 sub
You could even call a sub based on the the value of the texteffect.text
我对 AndEngine 库一无所知,所以这只是一个疯狂的猜测:
您是否可以使用
ChangeableText
(扩展Text
)而不是文本?从名称来看,您应该能够更改文本,并且查看代码,它还有几个用于设置文本的函数: ChangeableText 源
I don't know anything about the AndEngine library, so this would just be a wild guess:
Could you perhaps use the
ChangeableText
(which extendsText
) instead ofText
? From the name it sounds like you should be able to change the text, and looking at the code it also have a couple of functions to set the text: ChangeableText source并且您可以使用 ScoreValue.SetText();
and You can use scorevalue.SetText();