webview 如何禁止双击缩放, 但手指张开是可以缩放的
我想禁止webview 双击页面时,页面缩放的功能,但是手指张开活动 是可以张开的,这样的功能,如何实现呢???请大神指点一下哦
harris
10 years, 2 months ago
Answers
public class MyWebView extends WebView {
public MyWebView(Context context) {
super(context);
}
public MyWebView(Context context, AttributeSet attrs) {
super(context, attrs);
}
long last_time = 0;
@Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
long current_time = System.currentTimeMillis();
long d_time = current_time - last_time;
System.out.println(d_time);;
if (d_time < 300) {
last_time = current_time;
return true;
} else {
last_time = current_time;
}
break;
}
return super.onTouchEvent(event);
}
}
重新 onTouchEvent 事件就可以解决了
icehole
answered 10 years, 2 months ago