如何设置叠加层的不透明度? Android LayerDrawable

时间:2015-02-12 12:10:26

标签: android overlay drawable porter-duff 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);

还有其他方法吗?与PorterDuff.Mode可能吗?

1 个答案:

答案 0 :(得分:0)

您可以看到this

LayerDrawable有一个设置alpha的方法。这对你有帮助吗?