How to prevent Android's drawBitmap from only drawing black images?

前端 未结 2 999
Happy的楠姐
Happy的楠姐 2020-12-12 16:44

As per the original question, The end result is a rounded-rect png in an ImageView with a natural looking drop shadow.

I have the shadow wo

2条回答
  •  猫巷女王i
    2020-12-12 17:32

    I commented in your last question, but here it is again.

    The problem might be that you're drawing a 32-bit image (the original) onto an 8-bit image (the extracted shadowImage). If that's the case, do something like

    Bitmap shadowImage32 = shadowImage.copy(ARGB_8888, true);
    

    after the extractAlpha call, and draw onto that guy instead of the 8-bit shadowImage.

提交回复
热议问题