Android View基础知识点
来源:互联网 发布:佐川一政 知乎 编辑:程序博客网 时间:2024/06/10 23:18
View的位置参数
top,left,right,bottom.
width = right - left. height = bottom - top.
x,y,translationX,translationY.
translationX,translationY是View左上角相对于父容器的偏移量。
x = left + translationX. y = top + translationY.
MotionEvent
ACTION_DOWN
ACTION_MOVE
ACTION_UP
TouchSlop
touchSlop是系统所能识别出的被认为是滑动的最小距离。8dp。
VelocityTracker
速度追踪,用于追踪手指在滑动过程中的速度,包括水平和竖直方向的速度。
VelocityTracker velocityTracker = VelocityTracker.obtain();velocityTracker.addMovement(event);velocityTracker.computeCurrentVelocity(1000);int xVelocity = (int) velocityTracker.getXVelocity();int yVelocity = (int) velocityTracker.getYVelocity();velocityTracker.clear();velocityTracker.recycle();
GestureDetector
手势检测,用于辅助检测用户的单击,滑动,长按,双击等行为。
GestureDetector mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener(){});第二个参数中有选择地实现OnGestureListener和OnDoubleTapListener中的方法。
接管目标View的onTouchEvent方法。boolean consume = mGestureDetector.onTouchEvent(arg0);return consume;
Scroller
弹性滑动对象,用于实现View的弹性滑动。
阅读全文
0 0
- Android View基础知识点
- Android View滑动相关的基础知识点
- android 自定义View知识点
- android View知识点总结
- Android View相关知识点
- android View的相关知识点
- [Android 知识点] 自定义View(一)
- [Android 知识点] 自定义View(二)
- [Android 知识点] 自定义View(三)
- android基础知识点
- android 初学者 基础知识点
- 【Android】基础知识点备忘
- Android 基础知识点整理
- Android 基础知识点
- Android基础知识点总结
- Android基础知识点汇总
- Android 基础知识点总结
- android基础知识点
- Android AudioRecord和AudioTrack介绍
- B. Sagheer, the Hausmeister
- intellij-idea-plugin-(插件开发资料)
- linux基础命令介绍九:进程与内存
- Java实现青蛙跳台阶
- Android View基础知识点
- [noip2013] 货车运输(最大生成树+并查集+LCA)
- 数组的操作(一)
- EL表达式
- Android
- Cocoapods 安装(Mac OSX 10.12以后)
- 前端实现图片(img)预加载
- Js apply()和call()使用详解
- 受托支付 与 自主支付