Criando layouts personalizados no BlackBerry
Eu quero criar um RichTextField na metade inferior da tela, enquanto eu pinto meus próprios gráficos personalizados na metade superior da tela. Isso é possível no BlackBerry? Ele tentou definir um LayoutManager e tentar posicionar o RichTextField na parte inferior da tela, mas o RichTextField, percorrer a tela inteira. Este é o código para o LayoutManager (). É o caminho certo ou existe alguma outra maneira de fazer o que eu mencionei acima?
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;
}
}