ViewConfiguration.getScaledTouchSlop () 用法
getScaledTouchSlop是一个距离,表示滑动的时候,手的移动要大于这个距离才开始移动控件。如果小于这个距离就不触发移动控件,如viewpager就是用这个距离来判断用户是否翻页
ViewConfiguration滑动参数设置类:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
/** * 包含了方法和标准的常量用来设置UI的超时、大小和距离 */ public class ViewConfiguration { // 设定水平滚动条的宽度和垂直滚动条的高度,单位是像素px 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; } |
ViewConfiguration.getScaledTouchSlop () 用法的更多相关文章
- Android开发 ViewConfiguration 用法
ViewConfiguration 实例获取 ViewConfiguration viewConfiguration = ViewConfiguration.get(Context); 常用对象方法 ...
- 札记:android手势识别,MotionEvent
摘要 本文是手势识别输入事件处理的完整学习记录.内容包括输入事件InputEvent响应方式,触摸事件MotionEvent的概念和使用,触摸事件的动作分类.多点触摸.根据案例和API分析了触摸手势T ...
- Android develop tricks——整理自国外的一些Blog
ViewDragHelper --视图拖动是一个比較复杂的问题.这个类能够帮助解决不少问题.假设你须要一个样例,DrawerLayout就是利用它实现扫滑.Flavient Laurent 还写了一些 ...
- 自定义View系列教程01--常用工具介绍
站在源码的肩膀上全解Scroller工作机制 Android多分辨率适配框架(1)- 核心基础 Android多分辨率适配框架(2)- 原理剖析 Android多分辨率适配框架(3)- 使用指南 自定 ...
- 【转】Android开发中让你省时省力的方法、类、接口
转载 http://www.toutiao.com/i6362292864885457410/?tt_from=mobile_qq&utm_campaign=client_share& ...
- Android开发贴士集合
Activity.startActivities()——对于从app流的中部启动会非常好. TextUtils.isEmpty()——一个普遍适用的简单工具类. Html.fromHtml()——格式 ...
- Android开发中,那些让您觉得相见恨晚的方法、类或接口
Android开发中,那些让你觉得相见恨晚的方法.类或接口本篇文章内容提取自知乎Android开发中,有哪些让你觉得相见恨晚的方法.类或接口?,其实有一部是JAVA的,但是在android开发中也算常 ...
- Android开发中,那些让你相见恨晚的方法、类或接口
1.getParent().requestDisallowInterceptTouchEvent(true);剥夺父view 对touch 事件的处理权,谁用谁知道. 2.ArgbEvaluator. ...
- Android开发中,有哪些让你觉得相见恨晚的方法、类或接口?
ThumbnailUtils.extractThumbnail(bitmap, width, height); 压缩图片到指定大小的方法,以前都是一次次的createbitmap,然后用matrix去 ...
随机推荐
- Silverlight项目笔记6:Linq求差集、交集&检查网络连接状态&重载构造函数复用窗口
1.使用Linq求差集.交集 使用场景: 需要从数据中心获得用户数据,并以此为标准,同步系统的用户信息,对系统中多余的用户进行删除操作,缺失的用户进行添加操作,对信息更新了的用户进行编辑操作更新. 所 ...
- 菜鸟教程 Python100例 之实例29
学习编程的路,走得好艰辛... 为了巩固基础知识,把菜鸟教程网上的实例拿来练习.. 在做到实例29时,看了网站给出的代码,觉得可以加强一下功能,不由得动了一下脑筋,如下: 原文题目: 题目:给一个不多 ...
- Effective Java 19 Use interfaces only to define types
Reason The constant interface pattern is a poor use of interfaces. That a class uses some constants ...
- 使用POI实现数据导出Excel表格
package cn.sh.bzt.kwj.action; import java.io.IOException; import java.io.OutputStream; import java.t ...
- MongodbBackup Script
#!/usr/bin/env python # _*_coding:utf-8_*_ # Author: "Edward.Liu" # Author-Email: lonnyliu ...
- hdu 3064 twoNumber
twoNumber Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 2048/1024 K (Java/Others) Total Su ...
- hdu Flow Problem (最大流 裸题)
最大流裸题,贴下模版 view code#include <iostream> #include <cstdio> #include <cstring> #incl ...
- UVALive 6073 Math Magic
6073 Math MagicYesterday, my teacher taught us about m ...
- xamarin.android 图片高斯模糊效果
代码如下: private static float BITMAP_SCALE = 0.1f; private static float BLUR_RADIUS = 12.0f; public sta ...
- mac svn 终端操作命令
svn 删除目录命令 svn 提交命令 svn commit -m zenggui 出来要提交的目录后,按shift + : + q 如遇到不明白的可以输入:svn help 比如想查询删除命令的使用 ...