Code example for Canvas

Methods: drawARGBdrawBitmapdrawLinedrawPathdrawRectrestoresavetranslate

0
 
        @Override 
        protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
 
            canvas.drawARGB(255, 255, 255, 255);
 
            canvas.save();
            canvas.translate(200.0f, 60.0f);
            canvas.drawPath(mPath, mSmallPaint);
 
            canvas.translate(350.0f, 0.0f);
            canvas.drawPath(mPath, mMediumPaint);
 
            mLargePaint.setShader(mShader);
            canvas.translate(350.0f, 0.0f);
            canvas.drawPath(mPath, mLargePaint);
            mLargePaint.setShader(null);
            canvas.restore();
 
            canvas.save();
            canvas.translate(200.0f, 360.0f);
            canvas.drawPath(mPath, mSmallPaint);
            canvas.drawRect(mPathBounds, mBoundsPaint);
 
            canvas.translate(350.0f, 0.0f);
            canvas.drawBitmap(mBitmap, mPathBounds.left - mOffset * 1.5f,
                    mPathBounds.top - mOffset * 1.5f, null);
            canvas.drawRect(mPathBounds, mBoundsPaint);
            canvas.drawLine(0.0f, -360.0f, 0.0f, 500.0f, mLinePaint);
 
            mLargePaint.setShader(mShader);
            canvas.translate(350.0f, 0.0f);
            canvas.drawPath(mPath, mLargePaint);
            canvas.drawRect(mPathBounds, mBoundsPaint);
            mLargePaint.setShader(null);
            canvas.restore();
        } 
    } 
} 
Connect your IDE to all the code out there  Get Codota for Java