Je dessine par programme l'image d'arrière-plan (taille 320 * 480) pour l'écran d'accueil de mon application comme ci-dessous. La fonction de barre de défilement de l'écran est ajoutée. Aussi l'écran a beaucoup d'autres contrôles comme Label, EditField etc. dans plusieurs gestionnaires horizontaux. Mon problème est que, lorsque je fais défiler l'écran, l'image d'arrière-plan n'occupe pas la partie défilée ci-dessous, mais que je vois un fond blanc normal. Ça n'a pas l'air bien. Donc, je veux savoir comment puis-je placer l'image de fond même lorsque l'écran défile vers le bas?Blackberry - Problème avec l'image d'arrière-plan lorsque vous faites défiler l'écran
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..
}
Avez-vous essayé d'utiliser l'image de grande taille? essayez d'utiliser la longueur de l'image est de la longueur de la forme ... il peut résoudre votre problème ... –