j2me Polish中如何使TextField宽度与屏幕宽度相同?
我创建了一个 midlet,在该 midlet 中放置了一个 Form(javax.microedition.lcdui.Form
)。在该表单中,我放置了一个 TextField
(javax.microedition.lcdui.TextField
)。
我想让文本字段的宽度与表单的宽度相同。
I create a midlet, inside that midlet I placed a Form
(javax.microedition.lcdui.Form
). Inside that form I placed a TextField
(javax.microedition.lcdui.TextField
).
I want to make the width of textfield is same as form's width.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您引用的对象(
javax.microedition.lcdui...
)属于标准midp lcdui包,这些与j2mepolish 中查找更多详细信息。方法 Form.getWidth() 返回可用于项目的可显示区域的宽度(以像素为单位)。
MIDP 中提供了布局指令 API,以便按照您的描述显示 TextFileld。您可能需要使用指令将其设置为可扩展并占据单独的行。
这些主题在表单和项目的 MIDP (JSR 118) API 文档中进行了更详细的讨论:
值得注意的是,MIDP 2.0 允许设备实现忽略布局指令,而从 MIDP 2.1 开始,这些指令被指定为强制指令。
Objects you refer to (
javax.microedition.lcdui...
) belong to standard midp lcdui package, these have nothing to do with j2mepolish.Method Form.getWidth() returns the width in pixels of the displayable area available for items.
Layout directives API is provided in MIDP in order to display TextFileld as you describe. You'll likely need to use directives that set it expandable and occupy a separate line.
These topics are discussed in more details in MIDP (JSR 118) API documentation for Form and Item:
It is worth keeping in mind that MIDP 2.0 allows device implementation to ignore layout directives, while since MIDP 2.1 these are specified as mandatory.
默认情况下,它具有表单宽度,
我希望这会对您有所帮助。
谢谢
By Default it has width of form like
I hope this will help you.
Thanks