IT. Expert System.

Android Reference

OverScroller


android.widget

Class OverScroller



  • public class OverScroller
    extends Object
    This class encapsulates scrolling with the ability to overshoot the bounds of a scrolling operation. This class is a drop-in replacement for Scroller in most cases.
    • Method Summary

      Methods
      Modifier and Type Method and Description
      void abortAnimation()
      Stops the animation.
      boolean computeScrollOffset()
      Call this when you want to know the new location.
      void extendDuration(int extend)
      Deprecated.
      OverScrollers don't necessarily have a fixed duration. Instead of setting a new final position and extending the duration of an existing scroll, use startScroll to begin a new animation.
      void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, int maxY)
      void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, int maxY, int overX, int overY)
      Start scrolling based on a fling gesture.
      void forceFinished(boolean finished)
      Force the finished field to a particular value.
      float getCurrVelocity()
      Returns the absolute value of the current velocity.
      int getCurrX()
      Returns the current X offset in the scroll.
      int getCurrY()
      Returns the current Y offset in the scroll.
      int getDuration()
      Deprecated.
      OverScrollers don't necessarily have a fixed duration. This function will lie to the best of its ability.
      int getFinalX()
      Returns where the scroll will end.
      int getFinalY()
      Returns where the scroll will end.
      int getStartX()
      Returns the start X offset in the scroll.
      int getStartY()
      Returns the start Y offset in the scroll.
      boolean isFinished()
      Returns whether the scroller has finished scrolling.
      boolean isOverScrolled()
      Returns whether the current Scroller is currently returning to a valid position.
      boolean isScrollingInDirection(float xvel, float yvel)
      void notifyHorizontalEdgeReached(int startX, int finalX, int overX)
      Notify the scroller that we've reached a horizontal boundary.
      void notifyVerticalEdgeReached(int startY, int finalY, int overY)
      Notify the scroller that we've reached a vertical boundary.
      void setFinalX(int newX)
      Deprecated.
      OverScroller's final position may change during an animation. Instead of setting a new final position and extending the duration of an existing scroll, use startScroll to begin a new animation.
      void setFinalY(int newY)
      Deprecated.
      OverScroller's final position may change during an animation. Instead of setting a new final position and extending the duration of an existing scroll, use startScroll to begin a new animation.
      void setFriction(float friction)
      The amount of friction applied to flings.
      boolean springBack(int startX, int startY, int minX, int maxX, int minY, int maxY)
      Call this when you want to 'spring back' into a valid coordinate range.
      void startScroll(int startX, int startY, int dx, int dy)
      Start scrolling by providing a starting point and the distance to travel.
      void startScroll(int startX, int startY, int dx, int dy, int duration)
      Start scrolling by providing a starting point and the distance to travel.
      int timePassed()
      Returns the time elapsed since the beginning of the scrolling.
    • Constructor Detail

      • OverScroller

        public OverScroller(Context context)
        Creates an OverScroller with a viscous fluid scroll interpolator and flywheel.
        Parameters:
        context -
      • OverScroller

        public OverScroller(Context context,
                    Interpolator interpolator)
        Creates an OverScroller with flywheel enabled.
        Parameters:
        context - The context of this application.
        interpolator - The scroll interpolator. If null, a default (viscous) interpolator will be used.
      • OverScroller

        public OverScroller(Context context,
                    Interpolator interpolator,
                    boolean flywheel)
        Creates an OverScroller.
        Parameters:
        context - The context of this application.
        interpolator - The scroll interpolator. If null, a default (viscous) interpolator will be used.
        flywheel - If true, successive fling motions will keep on increasing scroll speed.
      • OverScroller

        public OverScroller(Context context,
                    Interpolator interpolator,
                    float bounceCoefficientX,
                    float bounceCoefficientY)
        Creates an OverScroller with flywheel enabled.
        Parameters:
        context - The context of this application.
        interpolator - The scroll interpolator. If null, a default (viscous) interpolator will be used.
        bounceCoefficientX - A value between 0 and 1 that will determine the proportion of the velocity which is preserved in the bounce when the horizontal edge is reached. A null value means no bounce. This behavior is no longer supported and this coefficient has no effect.
        bounceCoefficientY - Same as bounceCoefficientX but for the vertical direction. This behavior is no longer supported and this coefficient has no effect. !deprecated Use {!link #OverScroller(Context, Interpolator, boolean)} instead.
      • OverScroller

        public OverScroller(Context context,
                    Interpolator interpolator,
                    float bounceCoefficientX,
                    float bounceCoefficientY,
                    boolean flywheel)
        Creates an OverScroller.
        Parameters:
        context - The context of this application.
        interpolator - The scroll interpolator. If null, a default (viscous) interpolator will be used.
        bounceCoefficientX - A value between 0 and 1 that will determine the proportion of the velocity which is preserved in the bounce when the horizontal edge is reached. A null value means no bounce. This behavior is no longer supported and this coefficient has no effect.
        bounceCoefficientY - Same as bounceCoefficientX but for the vertical direction. This behavior is no longer supported and this coefficient has no effect.
        flywheel - If true, successive fling motions will keep on increasing scroll speed. !deprecated Use {!link OverScroller(Context, Interpolator, boolean)} instead.
    • Method Detail

      • setFriction

        public final void setFriction(float friction)
        The amount of friction applied to flings. The default value is ViewConfiguration.getScrollFriction().
        Parameters:
        friction - A scalar dimension-less value representing the coefficient of friction.
      • isFinished

        public final boolean isFinished()
        Returns whether the scroller has finished scrolling.
        Returns:
        True if the scroller has finished scrolling, false otherwise.
      • forceFinished

        public final void forceFinished(boolean finished)
        Force the finished field to a particular value. Contrary to abortAnimation(), forcing the animation to finished does NOT cause the scroller to move to the final x and y position.
        Parameters:
        finished - The new finished value.
      • getCurrX

        public final int getCurrX()
        Returns the current X offset in the scroll.
        Returns:
        The new X offset as an absolute distance from the origin.
      • getCurrY

        public final int getCurrY()
        Returns the current Y offset in the scroll.
        Returns:
        The new Y offset as an absolute distance from the origin.
      • getCurrVelocity

        public float getCurrVelocity()
        Returns the absolute value of the current velocity.
        Returns:
        The original velocity less the deceleration, norm of the X and Y velocity vector.
      • getStartX

        public final int getStartX()
        Returns the start X offset in the scroll.
        Returns:
        The start X offset as an absolute distance from the origin.
      • getStartY

        public final int getStartY()
        Returns the start Y offset in the scroll.
        Returns:
        The start Y offset as an absolute distance from the origin.
      • getFinalX

        public final int getFinalX()
        Returns where the scroll will end. Valid only for "fling" scrolls.
        Returns:
        The final X offset as an absolute distance from the origin.
      • getFinalY

        public final int getFinalY()
        Returns where the scroll will end. Valid only for "fling" scrolls.
        Returns:
        The final Y offset as an absolute distance from the origin.
      • getDuration

        @Deprecated
        public final int getDuration()
        Deprecated. OverScrollers don't necessarily have a fixed duration. This function will lie to the best of its ability.
        Returns how long the scroll event will take, in milliseconds.
        Returns:
        The duration of the scroll in milliseconds.
      • extendDuration

        @Deprecated
        public void extendDuration(int extend)
        Deprecated. OverScrollers don't necessarily have a fixed duration. Instead of setting a new final position and extending the duration of an existing scroll, use startScroll to begin a new animation.
        Extend the scroll animation. This allows a running animation to scroll further and longer, when used with setFinalX(int) or setFinalY(int).
        Parameters:
        extend - Additional time to scroll in milliseconds.
        See Also:
        setFinalX(int), setFinalY(int)
      • setFinalX

        @Deprecated
        public void setFinalX(int newX)
        Deprecated. OverScroller's final position may change during an animation. Instead of setting a new final position and extending the duration of an existing scroll, use startScroll to begin a new animation.
        Sets the final position (X) for this scroller.
        Parameters:
        newX - The new X offset as an absolute distance from the origin.
        See Also:
        extendDuration(int), setFinalY(int)
      • setFinalY

        @Deprecated
        public void setFinalY(int newY)
        Deprecated. OverScroller's final position may change during an animation. Instead of setting a new final position and extending the duration of an existing scroll, use startScroll to begin a new animation.
        Sets the final position (Y) for this scroller.
        Parameters:
        newY - The new Y offset as an absolute distance from the origin.
        See Also:
        extendDuration(int), setFinalX(int)
      • computeScrollOffset

        public boolean computeScrollOffset()
        Call this when you want to know the new location. If it returns true, the animation is not yet finished.
      • startScroll

        public void startScroll(int startX,
                       int startY,
                       int dx,
                       int dy)
        Start scrolling by providing a starting point and the distance to travel. The scroll will use the default value of 250 milliseconds for the duration.
        Parameters:
        startX - Starting horizontal scroll offset in pixels. Positive numbers will scroll the content to the left.
        startY - Starting vertical scroll offset in pixels. Positive numbers will scroll the content up.
        dx - Horizontal distance to travel. Positive numbers will scroll the content to the left.
        dy - Vertical distance to travel. Positive numbers will scroll the content up.
      • startScroll

        public void startScroll(int startX,
                       int startY,
                       int dx,
                       int dy,
                       int duration)
        Start scrolling by providing a starting point and the distance to travel.
        Parameters:
        startX - Starting horizontal scroll offset in pixels. Positive numbers will scroll the content to the left.
        startY - Starting vertical scroll offset in pixels. Positive numbers will scroll the content up.
        dx - Horizontal distance to travel. Positive numbers will scroll the content to the left.
        dy - Vertical distance to travel. Positive numbers will scroll the content up.
        duration - Duration of the scroll in milliseconds.
      • springBack

        public boolean springBack(int startX,
                         int startY,
                         int minX,
                         int maxX,
                         int minY,
                         int maxY)
        Call this when you want to 'spring back' into a valid coordinate range.
        Parameters:
        startX - Starting X coordinate
        startY - Starting Y coordinate
        minX - Minimum valid X value
        maxX - Maximum valid X value
        minY - Minimum valid Y value
        maxY - Minimum valid Y value
        Returns:
        true if a springback was initiated, false if startX and startY were already within the valid range.
      • fling

        public void fling(int startX,
                 int startY,
                 int velocityX,
                 int velocityY,
                 int minX,
                 int maxX,
                 int minY,
                 int maxY)
      • fling

        public void fling(int startX,
                 int startY,
                 int velocityX,
                 int velocityY,
                 int minX,
                 int maxX,
                 int minY,
                 int maxY,
                 int overX,
                 int overY)
        Start scrolling based on a fling gesture. The distance traveled will depend on the initial velocity of the fling.
        Parameters:
        startX - Starting point of the scroll (X)
        startY - Starting point of the scroll (Y)
        velocityX - Initial velocity of the fling (X) measured in pixels per second.
        velocityY - Initial velocity of the fling (Y) measured in pixels per second
        minX - Minimum X value. The scroller will not scroll past this point unless overX > 0. If overfling is allowed, it will use minX as a springback boundary.
        maxX - Maximum X value. The scroller will not scroll past this point unless overX > 0. If overfling is allowed, it will use maxX as a springback boundary.
        minY - Minimum Y value. The scroller will not scroll past this point unless overY > 0. If overfling is allowed, it will use minY as a springback boundary.
        maxY - Maximum Y value. The scroller will not scroll past this point unless overY > 0. If overfling is allowed, it will use maxY as a springback boundary.
        overX - Overfling range. If > 0, horizontal overfling in either direction will be possible.
        overY - Overfling range. If > 0, vertical overfling in either direction will be possible.
      • notifyHorizontalEdgeReached

        public void notifyHorizontalEdgeReached(int startX,
                                       int finalX,
                                       int overX)
        Notify the scroller that we've reached a horizontal boundary. Normally the information to handle this will already be known when the animation is started, such as in a call to one of the fling functions. However there are cases where this cannot be known in advance. This function will transition the current motion and animate from startX to finalX as appropriate.
        Parameters:
        startX - Starting/current X position
        finalX - Desired final X position
        overX - Magnitude of overscroll allowed. This should be the maximum desired distance from finalX. Absolute value - must be positive.
      • notifyVerticalEdgeReached

        public void notifyVerticalEdgeReached(int startY,
                                     int finalY,
                                     int overY)
        Notify the scroller that we've reached a vertical boundary. Normally the information to handle this will already be known when the animation is started, such as in a call to one of the fling functions. However there are cases where this cannot be known in advance. This function will animate a parabolic motion from startY to finalY.
        Parameters:
        startY - Starting/current Y position
        finalY - Desired final Y position
        overY - Magnitude of overscroll allowed. This should be the maximum desired distance from finalY. Absolute value - must be positive.
      • isOverScrolled

        public boolean isOverScrolled()
        Returns whether the current Scroller is currently returning to a valid position. Valid bounds were provided by the fling(int, int, int, int, int, int, int, int, int, int) method. One should check this value before calling startScroll(int, int, int, int) as the interpolation currently in progress to restore a valid position will then be stopped. The caller has to take into account the fact that the started scroll will start from an overscrolled position.
        Returns:
        true when the current position is overscrolled and in the process of interpolating back to a valid value.
      • timePassed

        public int timePassed()
        Returns the time elapsed since the beginning of the scrolling.
        Returns:
        The elapsed time in milliseconds.
      • isScrollingInDirection

        public boolean isScrollingInDirection(float xvel,
                                     float yvel)


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 3608 / . Delta: 0.09926 с