-
Notifications
You must be signed in to change notification settings - Fork 469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
请问我把onTouch相关的内容,写在自己集成的zxing的carputureActivity里,事件不触发,请问如果要实现缩放该添加哪些内容呢?新人,求大佬指教! #24
Comments
@jenly1314大大有空吗? |
不需要。不太清楚你代码怎么写的。
|
嗯,项目需要,现集成的是QRcode的库,需求要求加上手指缩放,我一开始想的是在CaputureActivity重写onTouchEvent,然后在判定双指的时候,进行缩放,但是断点显示事件没触发,所以一直不知道该怎么去修改,望大大指点,可以贴出代码 |
onTouchEvent中的主要逻辑如下: switch (event.getAction() & MotionEvent.ACTION_MASK) {//TODO: 多点触控
case MotionEvent.ACTION_POINTER_DOWN:
//TODO: 多点触摸按下时事件。此处记录手指按下时初始距离逻辑
break;
case MotionEvent.ACTION_MOVE:
//TODO: 移动时事件。计算出移动时手指距离与上一次移动时手指距离进行对比(初次移动的上一次距离为手指按下时初始距离),如果移动距离远了则放大变焦,反之则缩小变焦。
break;
} 具体示例可参见:CaptureActivity中的onTouchEvent方法。 |
谢谢大大解答,我重写的onTouchEvent事件是差不多的,现在困扰我的是这个事件没有触发,然后我一直找不到原因,但是看大大写的就能触发,所以在想是代码哪里不一样,还是我欠缺哪个地方没写,所以重写的事件无法被触发 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
是每次onTouch 一定要在camera.open一遍吗?可是我打断点,这个时间都没触发
The text was updated successfully, but these errors were encountered: