Je suis en train de faire l'image touchable qui peut se concentrer quand je défiler par bouton sur l'appareil touchable ceci est mon code pour l'image touchable:Blackberry Ajouter une bordure à l'image lorsque le focus
class TouchBitmapField extends BitmapField {
Bitmap bitmap;
boolean second;
int width;
public TouchBitmapField(Bitmap startBitmap, long style, int width, boolean second) {
super(startBitmap, style);
this.second = second;
bitmap = startBitmap;
this.width = width;
}
protected void drawFocus(Graphics g, boolean on){
g.setDrawingStyle(Graphics.DRAWSTYLE_FOCUS, true);
if(on){
drawHighlightRegion(g, Field.HIGHLIGHT_FOCUS, on, width-(bitmap.getWidth()/2), 0, bitmap.getWidth(), bitmap.getHeight());
}
paint(g);
}
protected boolean touchEvent(TouchEvent message) {
if (TouchEvent.CLICK == message.getEvent()) {
FieldChangeListener listener = getChangeListener();
if (null != listener)
listener.fieldChanged(this, 1);
}
return super.touchEvent(message);
}
}
Mais le problème est que seule partie transparente de l'image peut se concentrer et je résise ce bitmap avant de créer TouchBitmapField et comme vous le savez peut-être en train de réséquer bitmap supprimer la partie transparente et le remplacer par du noir. J'ai essayé cette classe http://www.patchou.com/2010/10/resizing-transparent-bitmaps-with-the-blackberry-jde/ pour redimensionner l'image mais j'ai 25 images sur mon écran et c'est inefficace. Une idée de comment faire la frontière sur l'image? Toute manière efficace de dessiner la frontière dans la méthode drawFocus(Graphics g, boolean on)
?