1

Now I create web view in my android. My webview is retrieved from available url. But now my webview cannot zoom in and out. Hope can understand my question and help me. Thank You Below is my code:

public class Tab1Fragment extends Fragment {
WebView webView;

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.tab1_fragment, container, false);
    webView = (WebView) view.findViewById(R.id.webview);
    WebSettings webSettings = webView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webView.loadUrl("https://www.facebook.com/");
    webView.setWebViewClient(new WebViewClient());
    return view;

}


}
Molly Molly
  • 125
  • 8
  • 1
    Possible duplicate of [How to enable zoom controls and pinch zoom in a WebView?](https://stackoverflow.com/questions/7121053/how-to-enable-zoom-controls-and-pinch-zoom-in-a-webview) – adnanyousafch Nov 07 '17 at 02:54

1 Answers1

0

On API >= 11, you can use:

webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setDisplayZoomControls(false);

As per the SDK:

public void setDisplayZoomControls (boolean enabled)

Also make sure that another controlling factor is "user-scalable" in the meta

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
Flutterian
  • 1,761
  • 1
  • 21
  • 47