0

I'm using custom Drawable with animation to draw function diagram...

notification tile diagram notification tile expanded diagram

and I use PorterDuff.Mode.SRC_IN PorterDuffXfermode to draw its brightness bar (to clear the overlaped track)


with no overscroll effect, the brightness bar thumb is well drawn.

with no overscroll

but if overscroll when animating, the thumb turn white.

with overscroll white thumb white thumb


pseudocode....

public class NotificationTileDrawable extends Drawable {

  PorterDuffXfermode xfer = new PorterDuffXfermode(PorterDuff.Mode.SRC_IN);
  Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);

  //...

  @Override
  public void draw(Canvas canvas) {

    //draw other...

    //draw track
    canvas.drawRoundRect(...);
    paint.setXfermode(xfer);
    //draw thumb
    canvas.drawRoundRect(...);
    paint.setXfermode(null);

    //draw other...

  }

  //other abstract methods...

}

how should i do to fix this? (without disable overscroll effect)

Thx

Ayaka_Ago
  • 89
  • 9

0 Answers0