启用缩放选项中的WebView安卓 [英] Enable Zoom Option In WebView Android

查看:156
本文介绍了启用缩放选项中的WebView安卓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发使用PhoneGap的应用程序。我无法启用内置的放大/缩小,在web视图。

我用下面code中的onCreate功能

 的WebView网页=(web视图)findViewById(R.id.webview);
。web.getSettings()setBuiltInZoomControls(真正的);
 

但没有奏效。

和Activity类是

activity_main.xml

 <的WebView的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:ID =@ + ID / web视图
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
/>
 

解决方案

检查,如果你没有一个滚动型包装你的web视图。

看来滚动型得到的捏手势的方式。

要修复它,只是把你的web视图的滚动型以外的次然后用同样的路线:

  webSettings.setBuiltInZoomControls(真正的);
webSettings.setSupportZoom(真正的);
 

否则,按照本教程

I am developing the application using PhoneGap. I cannot enable built in zoom in/out in the webview.

I used Following code in onCreate Function

WebView web = (WebView) findViewById(R.id.webview);
web.getSettings().setBuiltInZoomControls(true);

But it did not work.

And The Activity class is

activity_main.xml

<WebView  xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/> 

解决方案

Check if you don't have a ScrollView wrapping your Webview.

It seems ScrollView gets in the way of the pinch gesture.

To fix it, just take your Webview outside the ScrollView nd then use the same line:

webSettings.setBuiltInZoomControls(true);
webSettings.setSupportZoom(true);

Otherwise, follow this tutorial.

这篇关于启用缩放选项中的WebView安卓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆