Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public class

ViewConfiguration

extends Object
java.lang.Object
   ↳ android.view.ViewConfiguration

Class Overview

Contains methods to standard constants used in the UI for timeouts, sizes, and distances.

Summary

Public Constructors
ViewConfiguration ()
This constructor was deprecated in API level 3. Use get(android.content.Context) instead.
Public Methods
static ViewConfiguration get ( Context context)
Returns a configuration for the specified context.
static int getDoubleTapTimeout ()
static int getEdgeSlop ()
This method was deprecated in API level 3. Use getScaledEdgeSlop() instead.
static int getFadingEdgeLength ()
This method was deprecated in API level 3. Use getScaledFadingEdgeLength() instead.
static long getGlobalActionKeyTimeout ()
This method was deprecated in API level 20. This timeout should not be used by applications
static int getJumpTapTimeout ()
static int getKeyRepeatDelay ()
static int getKeyRepeatTimeout ()
static int getLongPressTimeout ()
static int getMaximumDrawingCacheSize ()
This method was deprecated in API level 3. Use getScaledMaximumDrawingCacheSize() instead.
static int getMaximumFlingVelocity ()
This method was deprecated in API level 4. Use getScaledMaximumFlingVelocity() instead.
static int getMinimumFlingVelocity ()
This method was deprecated in API level 3. Use getScaledMinimumFlingVelocity() instead.
static int getPressedStateDuration ()
int getScaledDoubleTapSlop ()
int getScaledEdgeSlop ()
int getScaledFadingEdgeLength ()
int getScaledMaximumDrawingCacheSize ()
The maximum drawing cache size expressed in bytes.
int getScaledMaximumFlingVelocity ()
int getScaledMinimumFlingVelocity ()
int getScaledOverflingDistance ()
int getScaledOverscrollDistance ()
int getScaledPagingTouchSlop ()
int getScaledScrollBarSize ()
int getScaledTouchSlop ()
int getScaledWindowTouchSlop ()
static int getScrollBarFadeDuration ()
static int getScrollBarSize ()
This method was deprecated in API level 3. Use getScaledScrollBarSize() instead.
static int getScrollDefaultDelay ()
static float getScrollFriction ()
The amount of friction applied to scrolls and flings.
static int getTapTimeout ()
static int getTouchSlop ()
This method was deprecated in API level 3. Use getScaledTouchSlop() instead.
static int getWindowTouchSlop ()
This method was deprecated in API level 3. Use getScaledWindowTouchSlop() instead.
static long getZoomControlsTimeout ()
The amount of time that the zoom controls should be displayed on the screen expressed in milliseconds.
boolean hasPermanentMenuKey ()
Report if the device has a permanent menu key available to the user.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ViewConfiguration ()

Added in API level 1

This constructor was deprecated in API level 3.
Use get(android.content.Context) instead.

Public Methods

public static ViewConfiguration get ( Context context)

Added in API level 3

Returns a configuration for the specified context. The configuration depends on various parameters of the context, like the dimension of the display or the density of the display.

Parameters
context The application context used to initialize the view configuration.

public static int getDoubleTapTimeout ()

Added in API level 3

Returns
  • the duration in milliseconds between the first tap's up event and the second tap's down event for an interaction to be considered a double-tap.

public static int getEdgeSlop ()

Added in API level 1

This method was deprecated in API level 3.
Use getScaledEdgeSlop() instead.

Returns
  • Inset in dips to look for touchable content when the user touches the edge of the screen

public static int getFadingEdgeLength ()

Added in API level 1

This method was deprecated in API level 3.
Use getScaledFadingEdgeLength() instead.

Returns
  • the length of the fading edges in dips

public static long getGlobalActionKeyTimeout ()

Added in API level 1

This method was deprecated in API level 20.
This timeout should not be used by applications

The amount of time a user needs to press the relevant key to bring up the global actions dialog.

Returns
  • how long a user needs to press the relevant key to bring up the global actions dialog.

public static int getJumpTapTimeout ()

Added in API level 1

Returns
  • the duration in milliseconds we will wait to see if a touch event is a jump tap. If the user does not move within this interval, it is considered to be a tap.

public static int getKeyRepeatDelay ()

Returns
  • the time between successive key repeats in milliseconds.

public static int getKeyRepeatTimeout ()

Returns
  • the time before the first key repeat in milliseconds.

public static int getLongPressTimeout ()

Added in API level 1

Returns
  • the duration in milliseconds before a press turns into a long press

public static int getMaximumDrawingCacheSize ()

Added in API level 1

This method was deprecated in API level 3.
Use getScaledMaximumDrawingCacheSize() instead.

The maximum drawing cache size expressed in bytes.

Returns
  • the maximum size of View's drawing cache expressed in bytes

public static int getMaximumFlingVelocity ()

Added in API level 4

This method was deprecated in API level 4.
Use getScaledMaximumFlingVelocity() instead.

Returns
  • Maximum velocity to initiate a fling, as measured in dips per second.

public static int getMinimumFlingVelocity ()

Added in API level 1

This method was deprecated in API level 3.
Use getScaledMinimumFlingVelocity() instead.

Returns
  • Minimum velocity to initiate a fling, as measured in dips per second.

public static int getPressedStateDuration ()

Added in API level 1

Returns
  • the duration in milliseconds of the pressed state in child components.

public int getScaledDoubleTapSlop ()

Added in API level 3

Returns
  • Distance in pixels between the first touch and second touch to still be considered a double tap

public int getScaledEdgeSlop ()

Added in API level 3

Returns
  • Inset in pixels to look for touchable content when the user touches the edge of the screen

public int getScaledFadingEdgeLength ()

Added in API level 3

Returns
  • the length of the fading edges in pixels

public int getScaledMaximumDrawingCacheSize ()

Added in API level 3

The maximum drawing cache size expressed in bytes.

Returns
  • the maximum size of View's drawing cache expressed in bytes

public int getScaledMaximumFlingVelocity ()

Added in API level 4

Returns
  • Maximum velocity to initiate a fling, as measured in pixels per second.

public int getScaledMinimumFlingVelocity ()

Added in API level 3

Returns
  • Minimum velocity to initiate a fling, as measured in pixels per second.

public int getScaledOverflingDistance ()

Added in API level 9

Returns
  • The maximum distance a View should overfling by when showing edge effects (in pixels).

public int getScaledOverscrollDistance ()

Added in API level 9

Returns
  • The maximum distance a View should overscroll by when showing edge effects (in pixels).

public int getScaledPagingTouchSlop ()

Added in API level 8

Returns
  • Distance in pixels a touch can wander before we think the user is scrolling a full page

public int getScaledScrollBarSize ()

Added in API level 3

Returns
  • The width of the horizontal scrollbar and the height of the vertical scrollbar in pixels

public int getScaledTouchSlop ()

Added in API level 3

Returns
  • Distance in pixels a touch can wander before we think the user is scrolling

public int getScaledWindowTouchSlop ()

Added in API level 3

Returns
  • Distance in pixels a touch must be outside the bounds of a window for it to be counted as outside the window for purposes of dismissing that window.

public static int getScrollBarFadeDuration ()

Added in API level 5

Returns
  • Duration of the fade when scrollbars fade away in milliseconds

public static int getScrollBarSize ()

Added in API level 1

This method was deprecated in API level 3.
Use getScaledScrollBarSize() instead.

Returns
  • The width of the horizontal scrollbar and the height of the vertical scrollbar in dips

public static int getScrollDefaultDelay ()

Added in API level 5

Returns
  • Default delay before the scrollbars fade in milliseconds

public static float getScrollFriction ()

Added in API level 1

The amount of friction applied to scrolls and flings.

Returns
  • A scalar dimensionless value representing the coefficient of friction.

public static int getTapTimeout ()

Added in API level 1

Returns
  • the duration in milliseconds we will wait to see if a touch event is a tap or a scroll. If the user does not move within this interval, it is considered to be a tap.

public static int getTouchSlop ()

Added in API level 1

This method was deprecated in API level 3.
Use getScaledTouchSlop() instead.

Returns
  • Distance in dips a touch can wander before we think the user is scrolling

public static int getWindowTouchSlop ()

Added in API level 1

This method was deprecated in API level 3.
Use getScaledWindowTouchSlop() instead.

Returns
  • Distance in dips a touch must be outside the bounds of a window for it to be counted as outside the window for purposes of dismissing that window.

public static long getZoomControlsTimeout ()

Added in API level 1

The amount of time that the zoom controls should be displayed on the screen expressed in milliseconds.

Returns
  • the time the zoom controls should be visible expressed in milliseconds.

public boolean hasPermanentMenuKey ()

Report if the device has a permanent menu key available to the user.

As of Android 3.0, devices may not have a permanent menu key available. Apps should use the action bar to present menu options to users. However, there are some apps where the action bar is inappropriate or undesirable. This method may be used to detect if a menu key is present. If not, applications should provide another on-screen affordance to access functionality.

Returns
  • true if a permanent menu key is present, false otherwise.