设置EditField中的黑莓的高度和宽度 [英] Set the height and width of EditField on BlackBerry
本文介绍了设置EditField中的黑莓的高度和宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想设置的 EditField中
的高度和宽度在我的黑莓应用程序。
I want to set the height and width of an EditField
in my BlackBerry app.
推荐答案
您需要覆盖领域的布局方法设置大小您:
You need to override the field's layout method to set the size for you:
protected void layout(int width, int height)
{
super.layout(customWidth, customHeight);
setExtent(customWidth, customHeight);
}
其中, customWidth
和 customHeight
已被你的其他地方。
-
super.layout(customWidth,customHeight)
奠定了现场使用您的特殊宽度放大器;高度。
super.layout(customWidth, customHeight)
lays the field out to use your special width & height.
setExtent(customWidth,customHeight)
设置字段的大小在屏幕上。
setExtent(customWidth, customHeight)
sets the size of the field on the screen.
当您使用类似于下面code code声明你EditField中你可以这样做:
You can do this when you declare your EditField using code similar to the below code:
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);
}
};
这篇关于设置EditField中的黑莓的高度和宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文