IT. Expert System.

Android Reference

Scroller


android.widget

Class Scroller



  • public class Scroller
    extends Object
    This class encapsulates scrolling. The duration of the scroll can be passed in the constructor and specifies the maximum time that the scrolling animation should take. Past this time, the scrolling is automatically moved to its final stage and computeScrollOffset() will always return false to indicate that scrolling is over.
    • Constructor Summary

      Constructors
      Constructor and Description
      Scroller(Context context)
      Create a Scroller with the default duration and interpolator.
      Scroller(Context context, Interpolator interpolator)
      Create a Scroller with the specified interpolator.
      Scroller(Context context, Interpolator interpolator, boolean flywheel)
      Create a Scroller with the specified interpolator.
    • 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)
      Extend the scroll animation.
      void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, int maxY)
      Start scrolling based on a fling gesture.
      void forceFinished(boolean finished)
      Force the finished field to a particular value.
      float getCurrVelocity()
      Returns 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()
      Returns how long the scroll event will take, in milliseconds.
      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 isScrollingInDirection(float xvel, float yvel)
      void setFinalX(int newX)
      Sets the final position (X) for this scroller.
      void setFinalY(int newY)
      Sets the final position (Y) for this scroller.
      void setFriction(float friction)
      The amount of friction applied to flings.
      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

      • Scroller

        public Scroller(Context context)
        Create a Scroller with the default duration and interpolator.
      • Scroller

        public Scroller(Context context,
                Interpolator interpolator)
        Create a Scroller with the specified interpolator. If the interpolator is null, the default (viscous) interpolator will be used. "Flywheel" behavior will be in effect for apps targeting Honeycomb or newer.
      • Scroller

        public Scroller(Context context,
                Interpolator interpolator,
                boolean flywheel)
        Create a Scroller with the specified interpolator. If the interpolator is null, the default (viscous) interpolator will be used. Specify whether or not to support progressive "flywheel" behavior in flinging.
    • 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.
        Parameters:
        finished - The new finished value.
      • getDuration

        public final int getDuration()
        Returns how long the scroll event will take, in milliseconds.
        Returns:
        The duration of the scroll in milliseconds.
      • 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 current velocity.
        Returns:
        The original velocity less the deceleration. Result may be negative.
      • 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.
      • computeScrollOffset

        public boolean computeScrollOffset()
        Call this when you want to know the new location. If it returns true, the animation is not yet finished. loc will be altered to provide the new location.
      • 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.
      • fling

        public void fling(int startX,
                 int startY,
                 int velocityX,
                 int velocityY,
                 int minX,
                 int maxX,
                 int minY,
                 int maxY)
        Start scrolling based on a fling gesture. The distance travelled 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.
        maxX - Maximum X value. The scroller will not scroll past this point.
        minY - Minimum Y value. The scroller will not scroll past this point.
        maxY - Maximum Y value. The scroller will not scroll past this point.
      • extendDuration

        public void extendDuration(int extend)
        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)
      • timePassed

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

        public void setFinalX(int newX)
        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

        public void setFinalY(int newY)
        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)
      • 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: 14630 / 248391853. Delta: 0.02353 с