Android examples for User Interface:Touch Event
expand View Touch Delegate
//package com.java2s; import android.graphics.Rect; import android.view.TouchDelegate; import android.view.View; public class Main { public static void expandViewTouchDelegate(final View view, final int top, final int bottom, final int left, final int right) { ((View) view.getParent()).post(new Runnable() { @Override/* w w w .j a va 2s. c o m*/ public void run() { Rect bounds = new Rect(); view.setEnabled(true); view.getHitRect(bounds); bounds.top -= top; bounds.bottom += bottom; bounds.left -= left; bounds.right += right; TouchDelegate touchDelegate = new TouchDelegate(bounds, view); if (View.class.isInstance(view.getParent())) { ((View) view.getParent()) .setTouchDelegate(touchDelegate); } } }); } }