Создание пользовательских макетов в BlackBerry
Я хочу создать RichTextField в нижней половине экрана, а я рисую свою собственную графику в верхней половине экрана. Это возможно в BlackBerry? Он попытался определить LayoutManager и попытаться расположить RichTextField в нижней части экрана, но RichTextField, прокрутить весь экран. Это код для LayoutManager (). Это правильный путь или есть какой-то другой способ сделать то, что я упомянул выше.
class LayoutManager extends Manager
{
public LayoutManager()
{
//construct a manager with vertical scrolling
super(VERTICAL_SCROLL);
}
//overwrite the nextFocus method for custom navigation
protected int nextFocus(int direction, boolean alt)
{
return super.nextFocus(direction, alt);
}
protected void sublayout(int width, int height)
{
Field field;
//get total number of fields within this manager
int numberOfFields = getFieldCount();
int x = 0;
int y = 0;
System.out.println("******** Fields: " + numberOfFields + " W/H: " + width + " / " + height );
for(int i = 0;i < numberOfFields;i++) {
field = getField(i); //get the field
x = 20;
y = 80;
System.out.println("******** X/Y: " + x + " / " + y);
setPositionChild(field, x, y); //set the position for the field
layoutChild(field, width, y); //lay out the field
}
setPosition(0, 80);
setExtent(width, 80);
}
public int getPreferredWidth()
{
return 160;
}
public int getPreferredHeight()
{
int height= 0;
int numberOfFields= getFieldCount();
for(int i= 0; i < numberOfFields; i++)
{
height += getField(i).getPreferredHeight();
}
return 160;
}
}