我以編程方式爲我的應用主屏幕繪製背景圖像(320 * 480大小),如下所示。 屏幕確實添加了滾動條設施。另外屏幕還有像Label,EditField等多個橫向管理器中的其他許多控件。Blackberry - 滾動屏幕時出現背景圖像
我的問題是,當我向下滾動屏幕時,背景圖像不佔據下面的滾動部分,而是我看到白色的正常背景。它看起來不太好。所以我想知道即使屏幕向下滾動,我如何放置背景圖像?
public MyHomescreen()
{
super();
LabelField appTitle = new LabelField ("MyApp Title");
setTitle(appTitle);
background = Bitmap.getBitmapResource ("HomeScreen.png");
_container = new VerticalFieldManager(Manager.VERTICAL_SCROLL
| Manager.VERTICAL_SCROLLBAR) {
protected void paint(Graphics g)
{
int y = MyHomescreen.this.getMainManager().getVerticalScroll();
g.clear();
g.drawBitmap(0, 0, background.getWidth(),
background.getHeight(), background, 0, 0);
super.paint(g);
}
protected void sublayout(int maxWidth, int maxHeight)
{
int width = background.getWidth();
int height = background.getHeight();
super.sublayout(width, height);
setExtent(width, height);
}
};
mainVerticalManager = new VerticalFieldManager(Manager.VERTICAL_SCROLL
| Manager.VERTICAL_SCROLLBAR)
{
protected void sublayout(int maxWidth, int maxHeight)
{
int width = background.getWidth();
int height = background.getHeight();
super.sublayout(width, height);
setExtent(width, height);
}
};
// code to add manager into the screen etc..
}
你嘗試過使用長尺寸圖片嗎? 嘗試使用圖像的長度是長度的形式... 它可能會解決您的問題... – 2010-05-14 06:10:44