读书笔记:Android开发艺术探索之第3章 View的事件体系

view的位置关系


width=right-left;

heihgt=bottom-top;

对应的值可以通过get方法获得,及getLeft;

3.0后

x=left+translationX;

y=top+translationY;


touchSlop最小滑动距离

获取方法:ViewConfiguration.get(getContext).getScaledTouchSlop;

VelocitTracker,滑动速率计算类。

GestureDetector,手势监听类

Scroller,平滑滚动类,同view的invalidate方法和computeScroll方法连用

View的滑动

scrollTo:相对于父类控件滑动的位置

scrollBy:相对应上一次该控件滑动的位置,scrollBy调用了scrollTo方法

同时这连个方法滑动的规律的上加下减,左加右减哦……


translationX,translationY,左右平移

LayoutParams,布局参数改变位置

View的事件分发机制:

dispatchTouchEvent,onInterceptTouchEvent,onTouchEvent

猜你喜欢

转载自blog.csdn.net/luck_xiang/article/details/74730957
今日推荐