我在我的黑莓应用程序中创建了 3 个选项卡。我现在想添加一个眼睑字段管理器,它只允许在第三个选项卡上使用眼睑组件。
使用当前代码,我可以创建一个眼睑,但它没有显示任何选项卡。
// setup the tab model with 3 tabs
final PaneManagerModel model = new PaneManagerModel();
model.enableLooping( true );
// setup the first tab
VerticalFieldManager vfm = new VerticalFieldManager(
Field.USE_ALL_HEIGHT | Field.USE_ALL_WIDTH |
Manager.NO_VERTICAL_SCROLL | Manager.NO_HORIZONTAL_SCROLL );
LabelField lbl = new LabelField( "Content for tab 1", Field.FOCUSABLE );
vfm.add( lbl );
ButtonField _btnGoBack = new ButtonField(" Tab 3 ",ButtonField.FIELD_HCENTER | ButtonField.CONSUME_CLICK);
_btnGoBack.setChangeListener(new FieldChangeListener()
{
public void fieldChanged(Field field,int context)
{
System.out.println("Inside button");
jumpTo(2,PaneManagerView.DIRECTION_NONE);
}
});
vfm.add(_btnGoBack);
MyLabelField myLbl = new MyLabelField( "Tab 1" );
NullField nullFld = new NullField( Field.FOCUSABLE );
HorizontalFieldManager hfm = new HorizontalFieldManager();
hfm.add( nullFld );
hfm.add( myLbl );
Pane pane = new Pane( hfm, vfm );
model.addPane( pane );
// setup the second tab
vfm = new VerticalFieldManager(
Field.USE_ALL_HEIGHT | Field.USE_ALL_WIDTH |
Manager.NO_VERTICAL_SCROLL | Manager.NO_HORIZONTAL_SCROLL );
lbl = new LabelField( "Content for tab 2", Field.FOCUSABLE );
vfm.add( lbl );
myLbl = new MyLabelField( "Tab 2" );
nullFld = new NullField( Field.FOCUSABLE );
hfm = new HorizontalFieldManager();
hfm.add( nullFld );
hfm.add( myLbl );
pane = new Pane( hfm, vfm );
model.addPane( pane );
//Setup the third tab
vfm = new VerticalFieldManager(
Field.USE_ALL_HEIGHT | Field.USE_ALL_WIDTH |
Manager.NO_VERTICAL_SCROLL | Manager.NO_HORIZONTAL_SCROLL );
lbl = new LabelField( "Content for tab 3", Field.FOCUSABLE );
vfm.add( lbl );
myLbl = new MyLabelField( "Tab 3" );
nullFld = new NullField( Field.FOCUSABLE );
hfm = new HorizontalFieldManager();
hfm.add( nullFld );
hfm.add( myLbl );
((LabelField)myLbl).setEnabled(false);
((NullField)nullFld).setEnabled(false);
在这里,我开始实施眼睑现场经理
_eyelidFieldManager = new EyelidFieldManager();
// Change the display time from the default 1.2s
_eyelidFieldManager.setEyelidDisplayTime(2000);
// Add components to the north eye-lid of the blinker
_eyelidFieldManager.vfm.addTop(new LabelField(" Do you wish to send report to client?",LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE));
_eyelidFieldManager.addTop(new LabelField(" ",LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE));
// Add components to the south eye-lid of the blinker
_eyelidFieldManager.addBottom(new LabelField(" Send Report as: ",LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE));
HorizontalFieldManager buttonPanel = new HorizontalFieldManager(Field.FIELD_HCENTER | Field.USE_ALL_WIDTH);
buttonPanel.add(new ButtonField("SMS"));
buttonPanel.add(new ButtonField("Email"));
_eyelidFieldManager.addBottom(buttonPanel);
// Add checkbox in non-eyelid region for showing eyelids on user input
_showOnInputCheckbox = new CheckboxField("Show eyelids on user input", true, Field.FIELD_HCENTER);
_showOnInputCheckbox.setChangeListener(this);
add(_eyelidFieldManager);
// Disable virtual keyboard so it doesn't obscure bottom eyelid
VirtualKeyboard keyboard = getVirtualKeyboard();
if( keyboard != null )
{
keyboard.setVisibility(VirtualKeyboard.IGNORE);
}
pane = new Pane( hfm, vfm );
model.addPane( pane );
// select the tab to be displayed
model.setCurrentlySelectedIndex( 0 );
现在设置其余的选项卡组件
// setup the rest of the components
HorizontalTabTitleView titleView = new HorizontalTabTitleView( Field.FOCUSABLE );
titleView.setNumberOfDisplayedTabs( 3 );
titleView.setModel( model );
PaneView paneView = new PaneView( Field.FOCUSABLE );
paneView.setModel( model );
PaneManagerView view = new PaneManagerView(
Field.FOCUSABLE | Manager.NO_VERTICAL_SCROLL |
Manager.NO_HORIZONTAL_SCROLL | Manager.USE_ALL_HEIGHT |
Manager.USE_ALL_WIDTH,
titleView, paneView );
view.setModel( model );
model.setView( view );
// configure the Controller
HorizontalTabController controller = new HorizontalTabController();
controller.setModel( model );
controller.setView( view );
model.setController( controller );
view.setController( controller );
// add the tab manager to the MainScreen
this.add( view );
}
任何知道解决方案的人请指导。谢谢