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 |
![]() |
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
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:
- Delay after entering activation area before auto-scrolling begins, see
setActivationDelay(int)
. Default value isgetTapTimeout()
to avoid conflicting with taps. - Location of activation areas, see
setEdgeType(int)
. Default value isEDGE_TYPE_INSIDE_EXTEND
. - Size of activation areas relative to view size, see
setRelativeEdges(float, float)
. Default value is 20% for both vertical and horizontal edges. - Maximum size used to constrain relative size, see
setMaximumEdges(float, float)
. Default value isNO_MAX
.
Scrolling
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 |
float |
NO_MIN
Constant passed to |
float |
RELATIVE_UNSPECIFIED
Constant passed to |