Use*_*ser 1 blackberry blackberry-editfield
我想EditField在我的BlackBerry应用程序中设置一个高度和宽度.
您需要覆盖字段的布局方法来为您设置大小:
protected void layout(int width, int height)
{
super.layout(customWidth, customHeight);
setExtent(customWidth, customHeight);
}
Run Code Online (Sandbox Code Playgroud)
其中,customWidth与customHeight已经被你在其他地方设置.
super.layout(customWidth, customHeight) 放下场地以使用您特殊的宽度和高度.
setExtent(customWidth, customHeight) 设置屏幕上字段的大小.
当您使用类似于以下代码的代码声明EditField时,可以执行此操作:
final int customWidth = Display.getWidth();
final int customHeight = 30;
Field myEditField = new EditField()
{
protected void layout(int width, int height)
{
super.layout(customWidth, customHeight);
setExtent(customWidth, customHeight);
}
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3153 次 |
| 最近记录: |