views:

246

answers:

1

Hi everybody,

I try to have a bitmap moving over my android application. I m be able to have my bitmap behind my text view, but not over them.

  public void onCreate(Bundle savedInstanceState)
...
     // ll is a FrameLayout
     ll.addView(text1);
     ll.addView(text2);
     ll.addView(new Panel(this),200,400);

my Panel class is defined like this :

    class Panel extends SurfaceView
......
 @Override
        public void onDraw(Canvas canvas) {
           canvas.drawColor(0, PorterDuff.Mode.CLEAR);
            Bitmap bitmap;
            GraphicObject.Coordinates coords;
            for (GraphicObject graphic : _graphics) {
                bitmap = graphic.getGraphic();
                coords = graphic.getCoordinates();
                canvas.drawBitmap(bitmap, coords.getX(), coords.getY(), null);
            }
        }

Can you help me ?

How Can i Draw a transparent bitmap over my views of my application

Thanks a lot,

Cheers,

Victor

A: 

I never tried myself, but what about using:

setForeground(Drawable drawable): Supply a Drawable that is to be rendered on top of all of the child views in the frame layout.

?

The drawable should be, to be transparent: http://developer.android.com/intl/fr/reference/android/graphics/drawable/ColorDrawable.html and the color might be something like= "#00XXXXXX" as the 2 first digits are the alpha channel...

Profete162