我有一個呈現白色圓形矩形的VerticalFieldManager。自定義管理器在添加到BlackBerry的VerticalFieldManager後未正確呈現
這是代碼:
VerticalFieldManager _vfmBackground = new VerticalFieldManager(Manager.NO_VERTICAL_SCROLL |
Manager.NO_VERTICAL_SCROLLBAR | Manager.USE_ALL_WIDTH){
public void paint(Graphics graphics)
{
graphics.clear();
graphics.setColor(Color.WHITE);
graphics.fillRoundRect(10, 10,460, 400, 25,25);
super.paint(graphics);
}
protected void sublayout(int maxWidth, int maxHeight)
{
int displayWidth = (Display.getWidth());
int displayHeight = (Display.getHeight());
super.sublayout(displayWidth, displayHeight);
setExtent(displayWidth, displayHeight);
}
};
然後,我創建了一個名爲BaseHeaderBlueScreen自定義Manager類呈現一個藍色的矩形:
public void paint(Graphics graphics)
{
graphics.clear();
graphics.setColor(610212);
graphics.fillRect(20, 0, Display.getWidth(), Display.getHeight());
super.paint(graphics);
}
protected void sublayout(int maxWidth, int maxHeight)
{
int displayWidth = (Display.getWidth()-40);
int displayHeight = ((Display.getHeight()/2))-90;
super.setExtent(displayWidth, displayHeight);
}
最後,我想補充的是自定義的經理與該VerticalFieldManager白色圓角矩形:
BaseHeaderBlueScreen _vhbs = new BaseHeaderBlueScreen(textTop, textBottom, 0);
_vhbs.setPadding(20,30,0,0);
_vfmBackground.add(_vhbs);
這是藍色的rec糾結應該顯示在白色矩形內。
但是,這是多麼當前正在顯示藍色矩形(請注意其左側的灰色空間):
我應該怎麼做才能使藍色矩形完全按照需要(沒有左邊的灰色邊框)?
謝謝奈特,它的工作! = d – Lucas