我在屏幕的底栏放了一个按钮.底栏基本上是具有背景图像的水平场管理器.现在,此按钮(基本上是一个继续按钮)用于移动到下一个屏幕.但如果我点击管理员并在按钮外面,它将进入下一个屏幕.所以click事件正在对总经理起作用,下面是代码:
HorizontalFieldManager hfmBtn = new HorizontalFieldManager(Field.FIELD_BOTTOM)
{
protected void sublayout(int nMaxWidth, int nMaxHeight)
{
height = Bitmap.getBitmapResource("buttom_bar.png").getHeight();
super.sublayout(nMaxWidth, nMaxHeight);
setExtent(getPreferredWidth(), getPreferredHeight());
}
public int getPreferredHeight()
{
return height;
}
public int getPreferredWidth()
{
return screenWidth;
}
};
hfmBtn.setBackground(BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("buttom_bar.png")));
btnContinue = new CustomButtonImageField("Continue", Bitmap.getBitmapResource("button_normal.png"), Bitmap.getBitmapResource("button_hover.png"),Field.FIELD_VCENTER);
btnContinue.setChangeListener(this);
btnContinue.setMargin(10, 0, 0, screenWidth/3);
hfmBtn.add(btnContinue);
add(hfmBtn);
Run Code Online (Sandbox Code Playgroud)
这是点击事件:
public void fieldChanged(Field field, int context)
{
if(field == btnContinue)
{
UiApplication.getUiApplication().pushScreen(new SendListScreen(platformContext,strItemList));
}
}
Run Code Online (Sandbox Code Playgroud)
请帮帮我..我在BB Bold 9790测试.
只需nullfield
在添加按钮之前添加一个.并使其成为焦点.那可行.
像这样添加nullField
然后添加button
.
hfmBtn.add(new nullField(Field.FOCUSABLE));
hfmBtn.add(btnContinue);
add(hfmBtn);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
542 次 |
最近记录: |