webview怎么禁止双击缩放
2个回答
展开全部
[java]
public class MyWebView extends WebView {
private long last_time = 0L;
public MyWebView(Context context) {
super(context);
}
public MyWebView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@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);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询