Code example for Canvas

Methods: drawRect, getClipBounds

0
        setImageBitmap(mBitmap);
    } 
 
    @Override 
    public void draw(Canvas canvas) {
        super.draw(canvas);
        if (isChecked()) { 
            canvas.drawRect(canvas.getClipBounds(), mForegroundPaint);
        } 
    } 
 
    @Override 
    public boolean isChecked() { 
        return mIsChecked;
    } 
 
    @Override 
    public void setChecked(boolean checked) {
        mIsChecked = checked;
    }