Masked ImageView has black background on Android 5 -
I would have been able to override the onraw method ImageView to apply under the image and it works fine, however, it's a small Android continues to 5. in fact it works on the Galaxy S II (4.1) and Nexus 4 (4.4.4), but not on Nexus 5 (5.0.1).
There is a black background on the Nexus 5 which is to draw behind the round image which I can not get rid of! When I turn to phone orientation for example, black background is gone.
class menu extends imageView {private RectF Rectangle = new RectF () Personal Paint paint1 = new paint (PaintkANTI_ALIAS_FLAG) Private paint2 paint = new paint () public menu () {paint2.setXfermode (New PorterDuffXfermode (Mode.SRC_IN))} Override zero OnDraw (canvas canvas) {final drawable drawable = getDrawable if (drawable == faucet) {super.onDraw (to canvas)} rectangle.set (0, 0, canvas.getWidth (), canvas.getHeight ()) int restore = canvas.saveLayer (rectangle, null, Canvas.ALL_SAVE_FLAG) canvas.drawRoundRect (rectangle, 50, 50, paint1) canvas.saveLayer (rectangle, paint2, Canvas.ALL_SAVE_FLAG) super. onDraw (canvas) canvas.restoreToCount (restored)}} Please syntactic errors As Ion or invalid C ignore onstructor I translate loosely Scala
The point hardware Acceleration was made by. I was showing a placeholder avatar, which is sung by SVG and I need to disable hardware acceleration. Then, when the actual bitmap is loading, I changed SVG with bitmap but did not return hardware acceleration. Now I was getting rid of the ugly black background. Although I still can not understand that if hardware acceleration is disabled, fails on code 5, while it works perfectly on other devices!
Comments
Post a Comment