-1

I have 10 fragments. All Fragments has different different layouts. One of the fragment has a WebView. This Webview is displaying html with javascript enable data. All is working fine in webview such as content loading. But webview is not scrolling horizontally. When i am trying to scroll, it swipe to next fragment page. Below is my code:

WebView w = (WebView) rootView.findViewById(R.id.webview1);
            w.getSettings().setLoadWithOverviewMode(false);
            w.getSettings().setUseWideViewPort(true);
            w.setInitialScale(120);
            w.setWebViewClient(new WebViewClient() {

                @SuppressWarnings("deprecation")
                @Override
                public boolean shouldOverrideUrlLoading(WebView view, String url) {
                    view.loadUrl(url);
                    return true;
                }

                @TargetApi(Build.VERSION_CODES.N)
                @Override
                public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
                    view.loadUrl(request.getUrl().toString());
                    return true;
                }
            });

            w.getSettings().setLoadsImagesAutomatically(true);
            w.getSettings().setJavaScriptEnabled(true);
            w.getSettings().setDomStorageEnabled(true);
            w.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
            w.loadUrl("my url");

My apologies this question already asked but i did not get solution. I have tried below answers.

WebView horizontal scrolling fails

How to scroll webview horizontally inside ViewPager?

Community
  • 1
  • 1
Rahul Rawat
  • 999
  • 2
  • 17
  • 40

1 Answers1

0

Is your fragment in tab view or something like this wich have right or left change fragment with swipe? If it is yes. you have to disable this. or you cant scroll.

Canberk Çakmak
  • 207
  • 1
  • 4
  • 16