added in version 22.1.0
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1

AutoScrollHelper

public abstract class AutoScrollHelper
extends Object implements View.OnTouchListener

java.lang.Object
   ↳ android.support.v4.widget.AutoScrollHelper
Known Direct Subclasses


AutoScrollHelper is a utility class for adding automatic edge-triggered scrolling to Views.

Note: Implementing classes are responsible for overriding the scrollTargetBy(int, int), canTargetScrollHorizontally(int), and canTargetScrollVertically(int) methods. See ListViewAutoScrollHelper for a ListView -specific implementation.

Activation

Automatic scrolling starts when the user touches within an activation area. By default, activation areas are defined as the top, left, right, and bottom 20% of the host view's total area. Touching within the top activation area scrolls up, left scrolls to the left, and so on.

As the user touches closer to the extreme edge of the activation area, scrolling accelerates up to a maximum velocity. When using the default edge type, EDGE_TYPE_INSIDE_EXTEND, moving outside of the view bounds will scroll at the maximum velocity.

The following activation properties may be configured:

Scrolling

When automatic scrolling is active, the helper will repeatedly call scrollTargetBy(int, int) to apply new scrolling offsets.

The following scrolling properties may be configured:

  • Acceleration ramp-up duration, see setRampUpDuration(int). Default value is 500 milliseconds.
  • Acceleration ramp-down duration, see setRampDownDuration(int). Default value is 500 milliseconds.
  • Target velocity relative to view size, see setRelativeVelocity(float, float). Default value is 100% per second for both vertical and horizontal.
  • Minimum velocity used to constrain relative velocity, see setMinimumVelocity(float, float). When set, scrolling will accelerate to the larger of either this value or the relative target value. Default value is approximately 5 centimeters or 315 dips per second.
  • Maximum velocity used to constrain relative velocity, see setMaximumVelocity(float, float). Default value is approximately 25 centimeters or 1575 dips per second.

Summary

Constants

int EDGE_TYPE_INSIDE

Edge type that specifies an activation area starting at the view bounds and extending inward.

int EDGE_TYPE_INSIDE_EXTEND

Edge type that specifies an activation area starting at the view bounds and extending inward.

int EDGE_TYPE_OUTSIDE

Edge type that specifies an activation area starting at the view bounds and extending outward.

float NO_MAX

Constant passed to setMaximumEdges(float, float), setMaximumVelocity(float, float), or setMinimumVelocity(float, float).

float NO_MIN

Constant passed to setMaximumEdges(float, float), or setMaximumVelocity(float, float), or setMinimumVelocity(float, float).

float RELATIVE_UNSPECIFIED

Constant passed to setRelativeEdges(float, float) or setRelativeVelocity(float, float).

Public constructors

AutoScrollHelper(View target)

Creates a new helper for scrolling the specified target view.

Public methods

abstract boolean canTargetScrollHorizontally(int direction)

Override this method to return whether the targe