Re-draw
HI, How can i re-draw the scrachable layer?
Recreating scratch layer is not available in the current version. Thanks for the suggestion. Will include in the next version.
When will this be added? This is most need feature
hi guys, I had to re-draw the scrachable layer. I override all class ScratchTextView and added this method:
public void repaint() {
if (this.mDrawable != null && this.mGradientBgPaint != null && mScratchBitmap != null) {
this.mScratchBitmap = Bitmap.createBitmap(this.getWidth(), this.getHeight(), Config.ARGB_8888);
this.mCanvas = new Canvas(this.mScratchBitmap);
Rect rect = new Rect(0, 0, this.mScratchBitmap.getWidth(), this.mScratchBitmap.getHeight());
this.mDrawable.setBounds(rect);
int startGradientColor = ContextCompat.getColor(this.getContext(), color.scratch_start_gradient);
int endGradientColor = ContextCompat.getColor(this.getContext(), color.scratch_end_gradient);
this.mGradientBgPaint.setShader(new LinearGradient(0.0F, 0.0F, 0.0F, (float) this.getHeight(), startGradientColor, endGradientColor, TileMode.MIRROR));
this.mCanvas.drawRect(rect, this.mGradientBgPaint);
this.mDrawable.draw(this.mCanvas);
this.invalidate();
}
}
that's work for me.
Please add this code and update de library Thanks!!!
How do you validate the onReveal listener again after repaint is done?
How do you validate the onReveal listener again after repaint is done? In my case,
I create a listener on variables like this: kotlin code: var event = onRevealListener(.........
when you use repaint method... view.repaint(.... view.setOnReveal( event)...
the same for onclickEvent..
good luck!
I tried the same but it wasn't working
visit https://github.com/gtmora200/ScratchView I cloned and changed the code. Look the examples, my code is on: others examples -> Game Lotto.


Ability to redraw, reveal fully and change image will be added soon. Apologies for the delay
Ability to redraw, reveal fully and change image will be added soon. Apologies for the delay
can you tell me when this update is available. Thanks for this nice library
is the update available??