androidoverlaydrawableporter-dufflayerdrawable

How to set Opacity of overlay? Android LayerDrawable


        layers[0] = view.getDrawable();
        layers[1] = r.getDrawable(R.drawable.dr);

        LayerDrawable layerDrawable = new LayerDrawable(layers);
        int width = layerDrawable.getIntrinsicWidth();
        int height = layerDrawable.getIntrinsicHeight();
        Bitmap bitmap = Bitmap.createBitmap(width, height,  Bitmap.Config.RGB_565);
        Canvas canvas = new Canvas(bitmap);
        layerDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
        layerDrawable.draw(canvas);

        view.setImageBitmap(bitmap);

Is there any other method? with PorterDuff.Mode maybe?


Solution

  • You can see this.

    LayerDrawable has a method for setting alpha. does this help you?