仅更改 Blackberry 中 TextField 标签的颜色
我正在尝试添加一个文本字段。我正在使用 EditField _textBox = new EditField("Subject", "Some text");
用于创建标签为 Subject 的文本框。我只想更改文本框标签(主题)的颜色。
I am trying to a add a TextField. I am usingEditField _textBox = new EditField("Subject", "Some text");
for creating a textbox with label as Subject. I want to change the color of only the label(Subject) of the textbox.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您将需要一个自定义字段来执行此操作,因为即使您重写
EditField.paint()EditField
标签的颜色>。我的建议是:
HorizontalFieldManager
的类(例如CustomEditField
),LabelField
和一个>EditField
用于可编辑文本代码如下:
当然,您仍然需要添加方法来设置并从 EditField 获取文本,以及您需要从 EditField 获得的任何其他特定方法,但作为概念证明,这是可行的。
You're going to need a custom field to do this because it is not possible to change the colour of the
EditField
's label, even if you overrideEditField.paint()
.My suggestion is:
CustomEditField
) which extendsHorizontalFieldManager
LabelField
for the label and anEditField
for the editable textHere's the code:
Of course, you're still going to need to add in your methods to set and get the text from your EditField, and any other specific methods which you need from EditField, but as a proof of concept this works.
您可以
重写
paint()
方法,并可以调用setColor(int RGB)
方法来提供您想要的颜色,这可能会有所帮助You can
Override
thepaint()
method and can call thesetColor(int RGB)
method to give the color you want may be this will help