代码改变世界

Android中view的事件

2016-01-21 15:27  飞机中毒  阅读(143)  评论(0)    收藏  举报

view:top、left、right、bottom,相对于parent的位置参数,获取通过get*()来获取。width=right-left、height=bottom-top。x=left+translationx,y=top+translationY。translationX和translationY默认都是0,在view平移过程中top和left是不变的,x、y和translationX、translationY变化。

motionEvent,TouchSlop

VelocityTracker,GestureDetector,Scroller

view三种滑动方式:1.view本身的scrollTo/scrollBy,2、施加平移效果,3、改变LayoutParams重新布局。

scroll只能滑动view内容不能滑动view本身。