Build 1.0_r1(from source)

android.view
Class TouchDelegate

java.lang.Object
  extended by android.view.TouchDelegate

public class TouchDelegate
extends Object

Helper class to handle situations where you want a view to have a larger touch area than its actual view bounds. The view whose touch area is changed is called the delegate view. This class should be used by an ancestor of the delegate. To use a TouchDelegate, first create an instance that specifies the bounds that should be mapped to the delegate and the delegate view itself.

The ancestor should then forward all of its touch events received in its View.onTouchEvent(MotionEvent) to onTouchEvent(MotionEvent).


Field Summary
static int ABOVE
          The touchable region of the View extends above its actual extent.
static int BELOW
          The touchable region of the View extends below its actual extent.
static int TO_LEFT
          The touchable region of the View extends to the left of its actual extent.
static int TO_RIGHT
          The touchable region of the View extends to the right of its actual extent.
 
Constructor Summary
TouchDelegate(Rect bounds, View delegateView)
          Constructor
 
Method Summary
 boolean onTouchEvent(MotionEvent event)
          Will forward touch events to the delegate view if the event is within the bounds specified in the constructor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ABOVE

public static final int ABOVE
The touchable region of the View extends above its actual extent.

See Also:
Constant Field Values

BELOW

public static final int BELOW
The touchable region of the View extends below its actual extent.

See Also:
Constant Field Values

TO_LEFT

public static final int TO_LEFT
The touchable region of the View extends to the left of its actual extent.

See Also:
Constant Field Values

TO_RIGHT

public static final int TO_RIGHT
The touchable region of the View extends to the right of its actual extent.

See Also:
Constant Field Values
Constructor Detail

TouchDelegate

public TouchDelegate(Rect bounds,
                     View delegateView)
Constructor

Parameters:
bounds - Bounds in local coordinates of the containing view that should be mapped to the delegate view
delegateView - The view that should receive motion events
Method Detail

onTouchEvent

public boolean onTouchEvent(MotionEvent event)
Will forward touch events to the delegate view if the event is within the bounds specified in the constructor.

Parameters:
event - The touch event to forward
Returns:
True if the event was forwarded to the delegate, false otherwise.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature