我在屏幕的底部欄中放置了一個按鈕。底欄基本上是一個帶有背景圖像的水平欄目管理員。此按鈕(基本上是繼續按鈕)用於移動到下一個屏幕。但是如果我點擊管理器和按鈕外部,它將進入下一個屏幕。因此,單擊事件正在總經理上,下面是代碼:點擊事件在按鈕外部工作
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);
這裏是click事件:
public void fieldChanged(Field field, int context)
{
if(field == btnContinue)
{
UiApplication.getUiApplication().pushScreen(new SendListScreen(platformContext,strItemList));
}
}
請幫我..我在BB大膽測試9790
沒有其他重點領域。所以默認焦點將在按鈕中。 – Signare 2012-03-27 05:39:27
一旦你點擊其他區域,你將獲得按鈕點擊事件。但是當你專注於其他領域時,你不會得到這個問題。所以添加一個Focusable字段進行測試比嘗試單擊按鈕.. – Hitarth 2012-03-27 06:26:12