Code example for TouchDelegate

0
        } 
        return new Rect(x, y, w, h);
    } 
 
    private void addTouchDelegate(Rect rect, int color, View delegateView) {
        mTouchDelegateGroup.addTouchDelegate(new TouchDelegate(rect, delegateView));
        mTouchDelegateRecords.add(new TouchDelegateRecord(rect, color));
    } 
 
    @Override 
    protected void dispatchDraw(Canvas canvas) {
        if (BuildConfig.DEBUG && TapRegionHighlighted) {
            for (TouchDelegateRecord record : mTouchDelegateRecords) {
                mPaint.setColor(record.color);
                canvas.drawRect(record.rect, mPaint);
            } 
        } 
        super.dispatchDraw(canvas);
    } 
 
    /**