expand View Touch Area - Android User Interface

Android examples for User Interface:Touch Event

Description

expand View Touch Area

Demo Code


//package com.java2s;

import android.graphics.Rect;
import android.view.TouchDelegate;
import android.view.View;

public class Main {
    public static void expandTouchArea(final View ownerView,
            final View delegateView) {
        delegateView.post(new Runnable() {
            @Override//from   w ww . ja  v a 2s .co m
            public void run() {
                final Rect r = new Rect();
                delegateView.getHitRect(r);
                delegateView.setTouchDelegate(new TouchDelegate(r,
                        ownerView));
            }
        });
    }
}

Related Tutorials