Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Blackberry 如何增加listfield所选项目的行高_Blackberry_Listfield - Fatal编程技术网

Blackberry 如何增加listfield所选项目的行高

Blackberry 如何增加listfield所选项目的行高,blackberry,listfield,Blackberry,Listfield,我正在使用我的应用程序的ListField在列表中显示数据。现在我的要求是增加列表中所选项目的行高 为此,我创建了一个GridFieldManager,并使用该管理器填充了我的列表。然后重写此管理器的onFocus()方法。但是,此方法从未被调用。因此,我无法增加所选行项目的高度 请提供帮助。ListField行的大小都是统一设计的,因此很遗憾,您无法直接更改一行的大小。您可以通过设置它来模拟它,以便上面和下面的行分别在底部和顶部绘制一点焦点颜色。或者,您可以有一个字段,该字段仅位于聚焦行上方的

我正在使用我的应用程序的
ListField
在列表中显示数据。现在我的要求是增加列表中所选项目的行高

为此,我创建了一个
GridFieldManager
,并使用该管理器填充了我的列表。然后重写此管理器的
onFocus()
方法。但是,此方法从未被调用。因此,我无法增加所选行项目的高度


请提供帮助。

ListField
行的大小都是统一设计的,因此很遗憾,您无法直接更改一行的大小。您可以通过设置它来模拟它,以便上面和下面的行分别在底部和顶部绘制一点焦点颜色。或者,您可以有一个字段,该字段仅位于聚焦行上方的中心位置。然后使用所选行的信息重新绘制此“浮动字段”

我让它工作了。我伪造了
ListField
实现。我删除了
ListField
,并将其替换为
VerticalFieldManager
。我在
onfocus()
onnfocus()
期间调整了它的大小,并使用
sublayout()
来更改此管理器的高度。这正是我想要的工作方式。

很抱歉,我忘了提到这一点。我还想增加
列表字段中使用的标签的字体高度。
you can increase the row height/font text/...
as ultimately, all of the api's call canvas's paint methods

how to do:
//try playing with the font_type,font height
Font myFont = Font.getDefault().derive(Font.PLAIN, 14, Ui.UNITS_px);

 private class ListCallback implements ListFieldCallback {

public void drawListRow(ListField list, Graphics g, int index, int y, int w) {
                g.setFont(myFont);
                String text = (String)listElements.elementAt(index);
                g.drawText(text, 0, y, 0, w);
//you can increase the height of a particular row in the height parameter.
// if you want it to be specific, put an 'if conditon'
EX: if(index=1)
{
w+=10;
}
            }
}