Skip to content

2.1 Changing attributes

Oscar Gilberto Medina Cruz edited this page May 6, 2017 · 2 revisions

Reconfigure DrawView attributes

DrawView provides a Paint instance with all the parameters needed for custom drawing. It can be accesible from a method:

mDrawView.getCurrentPaintParams()

You can use this instance in a Dialog for reconfigure all attributes, and then, pass the new parametters one by one.

mDrawView.setDrawColor(newPaint.getColor())
         .setPaintStyle(newPaint.getStyle())
         .setDither(newPaint.isDither())
         .setDrawWidth((int) newPaint.getStrokeWidth())
         .setDrawAlpha(newPaint.getAlpha())
         .setAntiAlias(newPaint.isAntiAlias())
         .setLineCap(newPaint.getStrokeCap())
         .setFontFamily(newPaint.getTypeface())
         .setFontSize(newPaint.getTextSize());

Or if you prefer, you can easily refresh new attributes using

mDrawView.refreshAttributes(newPaint);
Clone this wiki locally