Я предполагаю, что средняя часть ТОЛЬКО прокручиваемая, не так ли?
У вас должен быть один HorizontalFieldManager с HORIZONTAL_SCROLL (средний) , например. HorizontalFieldManager hfm = new HorizontalFieldManager(HORIZONTAL_SCROLL);
добавьте свое настраиваемое поле в этот менеджер.
Вы должны добавить hfm в Custom OuterManager.
Для справки я отправляю мой собственный код здесь ...
private class HScroll extends MainScreen{
public HScroll() {
super(USE_ALL_WIDTH);
OuterManager father = new OuterManager();
LabelField ll = new LabelField("<");
father.add(ll);
HorizontalFieldManager hfm = new HorizontalFieldManager(HORIZONTAL_SCROLL);
for(int i=0; i<10; i++){
ButtonField btn = new ButtonField(" i " + i);
hfm.add(btn);
}
father.add(hfm);
LabelField ll1 = new LabelField(">");
father.add(ll1);
add(father);
}
private class OuterManager extends net.rim.device.api.ui.Manager{
public OuterManager() {
super(USE_ALL_WIDTH);
}
protected void sublayout(int width, int height) {
int x = 0;
Field ff = getField(0);
Field ff2 = getField(2);
setPositionChild(ff, x, 0);
layoutChild(ff, ff.getPreferredWidth(), ff.getPreferredHeight());
x = x + ff.getPreferredWidth();
Field ff1 = getField(1);
setPositionChild(ff1, x , 0);
layoutChild(ff1, width - ff.getPreferredWidth() - ff2.getPreferredWidth() , ff1.getPreferredHeight());
x = width - ff2.getPreferredWidth();
setPositionChild(ff2, x, 0);
layoutChild(ff2, ff2.getPreferredWidth(), ff2.getPreferredHeight());
setExtent(width, height);
}
}
}
Существует еще один вариант для достижения этой цели ... Использование TableLayoutManager http://supportforums.blackberry.com/t5/ Java-Development/Create-a-rich-UI-layout-with-TableLayoutManager/ta-p/445299 –
Боковые стрелки (< and >) должны быть, скорее, объектами ButtonField, а не 'LabelFields'. – Nate
@Nate выше - всего лишь образец кода. –