ViewConfiguration常量字段介绍
2016-06-14 17:14
176 查看
/**
* 包含了方法和标准的常量用来设置UI的超时、大小和距离
*/
public class ViewConfiguration {
// 设定水平滚动条的宽度和垂直滚动条的高度
private static final int SCROLL_BAR_SIZE = 10;
//定义滚动条逐渐消失的时间,单位是毫秒
private static final int SCROLL_BAR_FADE_DURATION = 250;
// 默认的滚动条多少秒之后消失,单位是毫秒
private static final int SCROLL_BAR_DEFAULT_DELAY = 300;
// 定义边缘地方褪色的长度
private static final int FADING_EDGE_LENGTH = 12;
//定义子控件按下状态的持续事件
private static final int PRESSED_STATE_DURATION = 125;
//定义一个按下状态转变成长按状态的转变时间
private static final int LONG_PRESS_TIMEOUT = 500;
//定义用户在按住适当按钮,弹出全局的对话框的持续时间
private static final int GLOBAL_ACTIONS_KEY_TIMEOUT = 500;
//定义一个touch事件中是点击事件还是一个滑动事件所需的时间,如果用户不在这个时间之内滑动,那么就认为是一个点击事件
private static final int TAP_TIMEOUT = 115;
/**
* Defines the duration in milliseconds we will wait to see if a touch event
* is a jump tap. If the user does not complete the jump tap within this interval, it is
* considered to be a tap.
*/
//定义一个touch事件时候是一个点击事件。如果用户在这个时间内没有完成这个点击,那么就认为是一个点击事件
private static final int JUMP_TAP_TIMEOUT = 500;
//定义双击事件的间隔时间
private static final int DOUBLE_TAP_TIMEOUT = 300;
//定义一个缩放控制反馈到用户界面的时间
private static final int ZOOM_CONTROLS_TIMEOUT = 3000;
/**
* Inset in pixels to look for touchable content when the user touches the edge of the screen
*/
private static final int EDGE_SLOP = 12;
/**
* Distance a touch can wander before we think the user is scrolling in pixels
*/
private static final int TOUCH_SLOP = 16;
/**
* Distance a touch can wander before we think the user is attempting a paged scroll
* (in dips)
*/
private static final int PAGING_TOUCH_SLOP = TOUCH_SLOP * 2;
/**
* Distance between the first touch and second touch to still be considered a double tap
*/
private static final int DOUBLE_TAP_SLOP = 100;
/**
* Distance a touch needs to be outside of a window's bounds for it to
* count as outside for purposes of dismissing the window.
*/
private static final int WINDOW_TOUCH_SLOP = 16;
//用来初始化fling的最小速度,单位是每秒多少像素
private static final int MINIMUM_FLING_VELOCITY = 50;
//用来初始化fling的最大速度,单位是每秒多少像素
private static final int MAXIMUM_FLING_VELOCITY = 4000;
//视图绘图缓存的最大尺寸,以字节表示。在ARGB888格式下,这个尺寸应至少等于屏幕的大小
@Deprecated
private static final int MAXIMUM_DRAWING_CACHE_SIZE = 320 * 480 * 4; // HVGA screen, ARGB8888
//flings和scrolls摩擦力度大小的系数
private static float SCROLL_FRICTION = 0.015f;
/**
* Max distance to over scroll for edge effects
*/
private static final int OVERSCROLL_DISTANCE = 0;
/**
* Max distance to over fling for edge effects
*/
private static final int OVERFLING_DISTANCE = 4;
}
这是转载的比较早的版本,比如4.4.2就新增了一些常量
下面是源码字段
/**
* Defines the width of the horizontal scrollbar and the height of the vertical scrollbar in
* dips
*/
private static final int SCROLL_BAR_SIZE = 10;
/**
* Duration of the fade when scrollbars fade away in milliseconds
*/
private static final int SCROLL_BAR_FADE_DURATION = 250;
/**
* Default delay before the scrollbars fade in milliseconds
*/
private static final int SCROLL_BAR_DEFAULT_DELAY = 300;
/**
* Defines the length of the fading edges in dips
*/
private static final int FADING_EDGE_LENGTH = 12;
/**
* Defines the duration in milliseconds of the pressed state in child
* components.
*/
private static final int PRESSED_STATE_DURATION = 64;
/**
* Defines the default duration in milliseconds before a press turns into
* a long press
*/
private static final int DEFAULT_LONG_PRESS_TIMEOUT = 500;
/**
* Defines the time between successive key repeats in milliseconds.
*/
private static final int KEY_REPEAT_DELAY = 50;
/**
* Defines the duration in milliseconds a user needs to hold down the
* appropriate button to bring up the global actions dialog (power off,
* lock screen, etc).
*/
private static final int GLOBAL_ACTIONS_KEY_TIMEOUT = 500;
/**
* Defines 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.
*/
private static final int TAP_TIMEOUT = 180;
/**
* Defines the duration in milliseconds we will wait to see if a touch event
* is a jump tap. If the user does not complete the jump tap within this interval, it is
* considered to be a tap.
*/
private static final int JUMP_TAP_TIMEOUT = 500;
/**
* Defines 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.
*/
private static final int DOUBLE_TAP_TIMEOUT = 300;
/**
* Defines the minimum 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.
*/
private static final int DOUBLE_TAP_MIN_TIME = 40;
/**
* Defines the maximum duration in milliseconds between a touch pad
* touch and release for a given touch to be considered a tap (click) as
* opposed to a hover movement gesture.
*/
private static final int HOVER_TAP_TIMEOUT = 150;
/**
* Defines the maximum distance in pixels that a touch pad touch can move
* before being released for it to be considered a tap (click) as opposed
* to a hover movement gesture.
*/
private static final int HOVER_TAP_SLOP = 20;
/**
* Defines the duration in milliseconds we want to display zoom controls in response
* to a user panning within an application.
*/
private static final int ZOOM_CONTROLS_TIMEOUT = 3000;
/**
* Inset in dips to look for touchable content when the user touches the edge of the screen
*/
private static final int EDGE_SLOP = 12;
/**
* Distance a touch can wander before we think the user is scrolling in dips.
* Note that this value defined here is only used as a fallback by legacy/misbehaving
* applications that do not provide a Context for determining density/configuration-dependent
* values.
*
* To alter this value, see the configuration resource config_viewConfigurationTouchSlop
* in frameworks/base/core/res/res/values/config.xml or the appropriate device resource overlay.
* It may be appropriate to tweak this on a device-specific basis in an overlay based on
* the characteristics of the touch panel and firmware.
*/
private static final int TOUCH_SLOP = 8;
/**
* Distance the first touch can wander before we stop considering this event a double tap
* (in dips)
*/
private static final int DOUBLE_TAP_TOUCH_SLOP = TOUCH_SLOP;
/**
* Distance a touch can wander before we think the user is attempting a paged scroll
* (in dips)
*
* Note that this value defined here is only used as a fallback by legacy/misbehaving
* applications that do not provide a Context for determining density/configuration-dependent
* values.
*
* See the note above on {@link #TOUCH_SLOP} regarding the dimen resource
* config_viewConfigurationTouchSlop. ViewConfiguration will report a paging touch slop of
* config_viewConfigurationTouchSlop * 2 when provided with a Context.
*/
private static final int PAGING_TOUCH_SLOP = TOUCH_SLOP * 2;
/**
* Distance in dips between the first touch and second touch to still be considered a double tap
*/
private static final int DOUBLE_TAP_SLOP = 100;
/**
* Distance in dips a touch needs to be outside of a window's bounds for it to
* count as outside for purposes of dismissing the window.
*/
private static final int WINDOW_TOUCH_SLOP = 16;
/**
* Minimum velocity to initiate a fling, as measured in dips per second
*/
private static final int MINIMUM_FLING_VELOCITY = 50;
/**
* Maximum velocity to initiate a fling, as measured in dips per second
*/
private static final int MAXIMUM_FLING_VELOCITY = 8000;
/**
* Delay before dispatching a recurring accessibility event in milliseconds.
* This delay guarantees that a recurring event will be send at most once
* during the {@link #SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS} time
* frame.
*/
private static final long SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS = 100;
/**
* The maximum size of View's drawing cache, expressed in bytes. This size
* should be at least equal to the size of the screen in ARGB888 format.
*/
@Deprecated
private static final int MAXIMUM_DRAWING_CACHE_SIZE = 480 * 800 * 4; // ARGB8888
/**
* The coefficient of friction applied to flings/scrolls.
*/
private static final float SCROLL_FRICTION = 0.015f;
/**
* Max distance in dips to overscroll for edge effects
*/
private static final int OVERSCROLL_DISTANCE = 0;
/**
* Max distance in dips to overfling for edge effects
*/
private static final int OVERFLING_DISTANCE = 6;
private final int mEdgeSlop;
private final int mFadingEdgeLength;
private final int mMinimumFlingVelocity;
private final int mMaximumFlingVelocity;
private final int mScrollbarSize;
private final int mTouchSlop;
private final int mDoubleTapTouchSlop;
private final int mPagingTouchSlop;
private final int mDoubleTapSlop;
private final int mWindowTouchSlop;
private final int mMaximumDrawingCacheSize;
private final int mOverscrollDistance;
private final int mOverflingDistance;
private final boolean mFadingMarqueeEnabled;
private boolean sHasPermanentMenuKey;
private boolean sHasPermanentMenuKeySet;
static final SparseArray<ViewConfiguration> sConfigurations =
new SparseArray<ViewConfiguration>(2);
* 包含了方法和标准的常量用来设置UI的超时、大小和距离
*/
public class ViewConfiguration {
// 设定水平滚动条的宽度和垂直滚动条的高度
private static final int SCROLL_BAR_SIZE = 10;
//定义滚动条逐渐消失的时间,单位是毫秒
private static final int SCROLL_BAR_FADE_DURATION = 250;
// 默认的滚动条多少秒之后消失,单位是毫秒
private static final int SCROLL_BAR_DEFAULT_DELAY = 300;
// 定义边缘地方褪色的长度
private static final int FADING_EDGE_LENGTH = 12;
//定义子控件按下状态的持续事件
private static final int PRESSED_STATE_DURATION = 125;
//定义一个按下状态转变成长按状态的转变时间
private static final int LONG_PRESS_TIMEOUT = 500;
//定义用户在按住适当按钮,弹出全局的对话框的持续时间
private static final int GLOBAL_ACTIONS_KEY_TIMEOUT = 500;
//定义一个touch事件中是点击事件还是一个滑动事件所需的时间,如果用户不在这个时间之内滑动,那么就认为是一个点击事件
private static final int TAP_TIMEOUT = 115;
/**
* Defines the duration in milliseconds we will wait to see if a touch event
* is a jump tap. If the user does not complete the jump tap within this interval, it is
* considered to be a tap.
*/
//定义一个touch事件时候是一个点击事件。如果用户在这个时间内没有完成这个点击,那么就认为是一个点击事件
private static final int JUMP_TAP_TIMEOUT = 500;
//定义双击事件的间隔时间
private static final int DOUBLE_TAP_TIMEOUT = 300;
//定义一个缩放控制反馈到用户界面的时间
private static final int ZOOM_CONTROLS_TIMEOUT = 3000;
/**
* Inset in pixels to look for touchable content when the user touches the edge of the screen
*/
private static final int EDGE_SLOP = 12;
/**
* Distance a touch can wander before we think the user is scrolling in pixels
*/
private static final int TOUCH_SLOP = 16;
/**
* Distance a touch can wander before we think the user is attempting a paged scroll
* (in dips)
*/
private static final int PAGING_TOUCH_SLOP = TOUCH_SLOP * 2;
/**
* Distance between the first touch and second touch to still be considered a double tap
*/
private static final int DOUBLE_TAP_SLOP = 100;
/**
* Distance a touch needs to be outside of a window's bounds for it to
* count as outside for purposes of dismissing the window.
*/
private static final int WINDOW_TOUCH_SLOP = 16;
//用来初始化fling的最小速度,单位是每秒多少像素
private static final int MINIMUM_FLING_VELOCITY = 50;
//用来初始化fling的最大速度,单位是每秒多少像素
private static final int MAXIMUM_FLING_VELOCITY = 4000;
//视图绘图缓存的最大尺寸,以字节表示。在ARGB888格式下,这个尺寸应至少等于屏幕的大小
@Deprecated
private static final int MAXIMUM_DRAWING_CACHE_SIZE = 320 * 480 * 4; // HVGA screen, ARGB8888
//flings和scrolls摩擦力度大小的系数
private static float SCROLL_FRICTION = 0.015f;
/**
* Max distance to over scroll for edge effects
*/
private static final int OVERSCROLL_DISTANCE = 0;
/**
* Max distance to over fling for edge effects
*/
private static final int OVERFLING_DISTANCE = 4;
}
这是转载的比较早的版本,比如4.4.2就新增了一些常量
下面是源码字段
/**
* Defines the width of the horizontal scrollbar and the height of the vertical scrollbar in
* dips
*/
private static final int SCROLL_BAR_SIZE = 10;
/**
* Duration of the fade when scrollbars fade away in milliseconds
*/
private static final int SCROLL_BAR_FADE_DURATION = 250;
/**
* Default delay before the scrollbars fade in milliseconds
*/
private static final int SCROLL_BAR_DEFAULT_DELAY = 300;
/**
* Defines the length of the fading edges in dips
*/
private static final int FADING_EDGE_LENGTH = 12;
/**
* Defines the duration in milliseconds of the pressed state in child
* components.
*/
private static final int PRESSED_STATE_DURATION = 64;
/**
* Defines the default duration in milliseconds before a press turns into
* a long press
*/
private static final int DEFAULT_LONG_PRESS_TIMEOUT = 500;
/**
* Defines the time between successive key repeats in milliseconds.
*/
private static final int KEY_REPEAT_DELAY = 50;
/**
* Defines the duration in milliseconds a user needs to hold down the
* appropriate button to bring up the global actions dialog (power off,
* lock screen, etc).
*/
private static final int GLOBAL_ACTIONS_KEY_TIMEOUT = 500;
/**
* Defines 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.
*/
private static final int TAP_TIMEOUT = 180;
/**
* Defines the duration in milliseconds we will wait to see if a touch event
* is a jump tap. If the user does not complete the jump tap within this interval, it is
* considered to be a tap.
*/
private static final int JUMP_TAP_TIMEOUT = 500;
/**
* Defines 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.
*/
private static final int DOUBLE_TAP_TIMEOUT = 300;
/**
* Defines the minimum 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.
*/
private static final int DOUBLE_TAP_MIN_TIME = 40;
/**
* Defines the maximum duration in milliseconds between a touch pad
* touch and release for a given touch to be considered a tap (click) as
* opposed to a hover movement gesture.
*/
private static final int HOVER_TAP_TIMEOUT = 150;
/**
* Defines the maximum distance in pixels that a touch pad touch can move
* before being released for it to be considered a tap (click) as opposed
* to a hover movement gesture.
*/
private static final int HOVER_TAP_SLOP = 20;
/**
* Defines the duration in milliseconds we want to display zoom controls in response
* to a user panning within an application.
*/
private static final int ZOOM_CONTROLS_TIMEOUT = 3000;
/**
* Inset in dips to look for touchable content when the user touches the edge of the screen
*/
private static final int EDGE_SLOP = 12;
/**
* Distance a touch can wander before we think the user is scrolling in dips.
* Note that this value defined here is only used as a fallback by legacy/misbehaving
* applications that do not provide a Context for determining density/configuration-dependent
* values.
*
* To alter this value, see the configuration resource config_viewConfigurationTouchSlop
* in frameworks/base/core/res/res/values/config.xml or the appropriate device resource overlay.
* It may be appropriate to tweak this on a device-specific basis in an overlay based on
* the characteristics of the touch panel and firmware.
*/
private static final int TOUCH_SLOP = 8;
/**
* Distance the first touch can wander before we stop considering this event a double tap
* (in dips)
*/
private static final int DOUBLE_TAP_TOUCH_SLOP = TOUCH_SLOP;
/**
* Distance a touch can wander before we think the user is attempting a paged scroll
* (in dips)
*
* Note that this value defined here is only used as a fallback by legacy/misbehaving
* applications that do not provide a Context for determining density/configuration-dependent
* values.
*
* See the note above on {@link #TOUCH_SLOP} regarding the dimen resource
* config_viewConfigurationTouchSlop. ViewConfiguration will report a paging touch slop of
* config_viewConfigurationTouchSlop * 2 when provided with a Context.
*/
private static final int PAGING_TOUCH_SLOP = TOUCH_SLOP * 2;
/**
* Distance in dips between the first touch and second touch to still be considered a double tap
*/
private static final int DOUBLE_TAP_SLOP = 100;
/**
* Distance in dips a touch needs to be outside of a window's bounds for it to
* count as outside for purposes of dismissing the window.
*/
private static final int WINDOW_TOUCH_SLOP = 16;
/**
* Minimum velocity to initiate a fling, as measured in dips per second
*/
private static final int MINIMUM_FLING_VELOCITY = 50;
/**
* Maximum velocity to initiate a fling, as measured in dips per second
*/
private static final int MAXIMUM_FLING_VELOCITY = 8000;
/**
* Delay before dispatching a recurring accessibility event in milliseconds.
* This delay guarantees that a recurring event will be send at most once
* during the {@link #SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS} time
* frame.
*/
private static final long SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS = 100;
/**
* The maximum size of View's drawing cache, expressed in bytes. This size
* should be at least equal to the size of the screen in ARGB888 format.
*/
@Deprecated
private static final int MAXIMUM_DRAWING_CACHE_SIZE = 480 * 800 * 4; // ARGB8888
/**
* The coefficient of friction applied to flings/scrolls.
*/
private static final float SCROLL_FRICTION = 0.015f;
/**
* Max distance in dips to overscroll for edge effects
*/
private static final int OVERSCROLL_DISTANCE = 0;
/**
* Max distance in dips to overfling for edge effects
*/
private static final int OVERFLING_DISTANCE = 6;
private final int mEdgeSlop;
private final int mFadingEdgeLength;
private final int mMinimumFlingVelocity;
private final int mMaximumFlingVelocity;
private final int mScrollbarSize;
private final int mTouchSlop;
private final int mDoubleTapTouchSlop;
private final int mPagingTouchSlop;
private final int mDoubleTapSlop;
private final int mWindowTouchSlop;
private final int mMaximumDrawingCacheSize;
private final int mOverscrollDistance;
private final int mOverflingDistance;
private final boolean mFadingMarqueeEnabled;
private boolean sHasPermanentMenuKey;
private boolean sHasPermanentMenuKeySet;
static final SparseArray<ViewConfiguration> sConfigurations =
new SparseArray<ViewConfiguration>(2);
相关文章推荐
- 交换两个整型变量的值
- TabHost的使用
- 你必须弄懂的Intent Filter匹配规则
- 【51CTO学院三周年】带你转行啦
- 探究论文检测系统抄袭的算法原理等技术研究
- JDBC中的批量执行
- PowerDesigner 开发数据库建模
- 浅谈算法和数据结构: 十 平衡查找树之B树
- 依赖倒转原则
- guava Function Predicate Supplier
- BZOJ 2741 【FOTILE模拟赛】L(可持久化trie)
- 过滤网址和输入框中的特殊字符,防止sql注入(C#版)
- 浅谈算法和数据结构: 九 平衡查找树之红黑树
- Android Studio构建优化
- C语言的结构体(篇章之一)
- 如何快速的定位程序中某个功能对应的代码?
- mvp模式
- javascript计算前1!+2!+...+n!的阶乘和
- iOS 一个app跳转另一个app并实现通信(如A跳到B并打开B中指定页面)
- 浅谈算法和数据结构: 八 平衡查找树之2-3树