title: Android SwipeRefreshLayout webview unable to scroll down
body: <p>I am new to the android. Currently I want to use the SwipeRefreshLayout with webview but I am unable to scroll down in my webview, everytime I scroll down will trigger the SwipeRefreshLayout event. Any suggestion and step I can avoid this ?Below is sample coding i refer to.</p>
  
  <p>Here is my current layout:</p>
  
  <pre><code>   &lt;android.support.v4.widget.SwipeRefreshLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:id="@+id/swipe"&gt;
  
  
      &lt;WebView 
          android:id="@+id/webview"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent" /&gt;
  
  
  &lt;/android.support.v4.widget.SwipeRefreshLayout&gt;
  </code></pre>
  
  <p>And here is my activity</p>
  
  <pre><code>package com.example.web3;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.support.v4.widget.SwipeRefreshLayout;
  import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener;
  import android.util.Log;
  import android.view.KeyEvent;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.ViewTreeObserver;
  import android.webkit.WebChromeClient;
  import android.webkit.WebView;
  import android.webkit.WebViewClient;
  import android.widget.EditText;
  import android.widget.Toast;
  
  
  public class MainActivity extends Activity {
  
         private WebView webView;
          private SwipeRefreshLayout swipeRefresh;
  
          @Override
          protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_main);
  
              //SwipeRefresh
              swipeRefresh = (SwipeRefreshLayout)findViewById(R.id.swipe_contain);
              swipeRefresh.setOnRefreshListener(new OnRefreshListener() {
                  @Override
                  public void onRefresh() {
  
                      webView.loadUrl(webView.getUrl());
                  }
              });
              swipeRefresh.setColorScheme(android.R.color.holo_blue_light, 
                                                   android.R.color.holo_red_light, 
                                                   android.R.color.holo_orange_light, 
                                                   android.R.color.holo_green_light);
  
              webView = (WebView)findViewById(R.id.web_show);
  
              webView.loadUrl("http://192.168.0.28/sample/index.html");
  
              webView.getSettings().setJavaScriptEnabled(true);
  
              webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
  
              webView.requestFocus(); 
  
              webView.setWebViewClient(new WebViewClient(){
                  @Override
                  public boolean shouldOverrideUrlLoading(WebView view, String url) {
                      view.loadUrl(url);
                      return true;
                  }
              });
  
              webView.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
                    @Override
                    public void onScrollChanged() {
                       if (webView.getScrollY() == 0) {
                           swipeRefresh.setEnabled(true);
                        } else {
                            swipeRefresh.setEnabled(false);
                        }
                    }
                  });
  
  
  
              webView.setWebChromeClient(new WebChromeClient(){
                  @Override
                  public void onProgressChanged(WebView view, int newProgress) {
                      if(newProgress == 100){
  
                          swipeRefresh.setRefreshing(false);
                      }else if(!swipeRefresh.isRefreshing()){
                          swipeRefresh.setRefreshing(true);
  
                      }
                  }
              });
          }
  
  
  
  }
  </code></pre>