android 手势切换 activity
来源:互联网 发布:js点击链接弹出下拉框 编辑:程序博客网 时间:2024/06/05 16:57
public class OnGesterListenerIMP implements OnGestureListener {private ActivityTouchIntent callback;private boolean isIntentNext;public OnGesterListenerIMP(ActivityTouchIntent callback,boolean isIntentNext){this.callback=callback;this.isIntentNext=isIntentNext;}public boolean onDown(MotionEvent e) {// TODO Auto-generated method stubreturn false;}public void onShowPress(MotionEvent e) {// TODO Auto-generated method stub}public boolean onSingleTapUp(MotionEvent e) {// TODO Auto-generated method stubreturn false;}public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,float distanceY) {// TODO Auto-generated method stubreturn false;}public void onLongPress(MotionEvent e) {// TODO Auto-generated method stub}public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,float velocityY) {// TODO Auto-generated method stubif (e2.getX()-e1.getX()>200) {callback.callbackFinished();}if (Math.abs(e2.getX()-e1.getX())>200) {if(isIntentNext){callback.callbackIntentNext();}}return false;}public interface ActivityTouchIntent{void callbackIntentNext();void callbackFinished();}}
手势切换 (isIntentNext 是否需要进入下一个activity),注意:scrollview event事件获取不到需要dispatchTouchEvent重写(如果有listview 需要setTouchEvent..事件派发):
@Overridepublic boolean dispatchTouchEvent(MotionEvent event) {// TODO Auto-generated method stubnew GestureDetector(this,new OnGesterListenerIMP(this, true)).onTouchEvent(event);return super.dispatchTouchEvent(event);}
0 0
- android 手势切换 activity
- Android 手势滑动切换activity
- android手势操作&&实现滑动切换activity
- SlidingActivity 手势控制Activity切换
- tabhost通过手势滑动切换activity
- Android 切换Activity
- Android滑动切换activity
- android 横向切换 activity
- android activity 动画切换
- android activity 切换+动画
- Android动画切换Activity
- android之activity切换
- android之activity切换
- android 切换activity状态
- android activity切换效果
- Android Activity状态切换
- Android Activity切换动画
- Android Activity切换动画
- 关于@property
- SQL日期(转)
- iOS 去掉UItableview header(footer)view黏性(sticky)?
- get与post
- SQL函数说明大全 (转)
- android 手势切换 activity
- 百度2015校园招聘自然语言处理工程师面试
- Qt读写ini文件的C++类
- mvc框架下,怎样用cookie实现下次自动登录
- 异常 Exception RuntimeException throws throw 自定义异常 finally
- <2>Python和一些其他软件的安装
- android Appliction描述
- 可变参数、重写与重载
- WinRT的ref类 —— 微软神雕乱枪改C++系列