title: WebView can't scroll down in SwipeRefreshLayout
body: <p>I have a webview and want it to be able refresh went i swipe it. It works and can refresh the page. But the problem is when I scroll down the page, it always trigger to refresh not to go upper page. This is my Activity.java</p>
  <pre><code>public class MainActivity extends Activity {
  
      private WebView mWebView;
      private static final String TAG = MainActivity.class.getSimpleName();
      public SwipeRefreshLayout swipeRefreshLayout;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          mWebView = findViewById(R.id.activity_main_webview);
          WebSettings webSettings = mWebView.getSettings();
          webSettings.setJavaScriptEnabled(true);
          mWebView.setWebViewClient(new MyWebViewClient());
          swipeRefreshLayout = (SwipeRefreshLayout)this.findViewById(R.id.swipe);
          mWebView.loadUrl(&quot;https://hkmu.comercio.co.id&quot;);
  ...
          mWebView.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
              @Override
              public void onScrollChanged() {
                  if(mWebView.getScrollY()==0){
                      swipeRefreshLayout.setEnabled(true);
                  }else{
                      swipeRefreshLayout.setEnabled(false);
                  }
              }
          }); 
  
          swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
              @Override
              public void onRefresh() {
                  swipeRefreshLayout.setRefreshing(true);
                  new Handler().postDelayed(new Runnable() {
                      @Override
                      public void run() {
                          swipeRefreshLayout.setRefreshing(false);
                          mWebView.reload();
                      }
                  }, 2000);
              }
          });
          swipeRefreshLayout.setColorSchemeColors(
                  getResources().getColor(android.R.color.holo_blue_dark),
                  getResources().getColor(android.R.color.holo_orange_dark),
                  getResources().getColor(android.R.color.holo_green_dark),
                  getResources().getColor(android.R.color.holo_red_dark)
          );
  </code></pre>
  <p>and this is my activity_main.xml</p>
  <pre><code>&lt;LinearLayout
      xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      tools:context=&quot;.MainActivity&quot;&gt;
      &lt;androidx.swiperefreshlayout.widget.SwipeRefreshLayout
          android:id=&quot;@+id/swipe&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;&gt;
          &lt;WebView
              android:id=&quot;@+id/activity_main_webview&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;match_parent&quot; /&gt;
      &lt;/androidx.swiperefreshlayout.widget.SwipeRefreshLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  <p>I know maybe my question is duplicate, I've already search it but I'm still stucked and those answer doesn't work for me</p>
  <h1>EDIT 1</h1>
  <p>I'm already change my code like this</p>
  <pre><code>public class MainActivity extends Activity {
  
      private WebView mWebView;
      private static final String TAG = MainActivity.class.getSimpleName();
      public SwipeRefreshLayout swipeRefreshLayout;
      private ViewTreeObserver.OnScrollChangedListener mOnScrollChangedListener;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          mWebView = findViewById(R.id.activity_main_webview);
          WebSettings webSettings = mWebView.getSettings();
          webSettings.setJavaScriptEnabled(true);
          mWebView.setWebViewClient(new MyWebViewClient());
          swipeRefreshLayout = (SwipeRefreshLayout)this.findViewById(R.id.swipe);
          mWebView.loadUrl(&quot;https://hkmu.comercio.co.id&quot;);
  ...
          swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
              @Override
              public void onRefresh() {
                  swipeRefreshLayout.setRefreshing(true);
                  new Handler().postDelayed(new Runnable() {
                      @Override
                      public void run() {
                          swipeRefreshLayout.setRefreshing(false);
                          mWebView.reload();
                      }
                  }, 2000);
              }
          });
          swipeRefreshLayout.setColorSchemeColors(
                  getResources().getColor(android.R.color.holo_blue_dark),
                  getResources().getColor(android.R.color.holo_orange_dark),
                  getResources().getColor(android.R.color.holo_green_dark),
                  getResources().getColor(android.R.color.holo_red_dark)
          );
          @Override
          public void onStart() {
              super.onStart();
  
              swipeRefreshLayout.getViewTreeObserver().addOnScrollChangedListener(mOnScrollChangedListener =
                  new ViewTreeObserver.OnScrollChangedListener() {
                      @Override
                      public void onScrollChanged() {
                          if (mWebView.getScrollY() == -1)
                              swipeRefreshLayout.setEnabled(true);
                          else
                              swipeRefreshLayout.setEnabled(false);
  
                      }
                  });
              swipeRefreshLayout.getViewTreeObserver().addOnScrollChangedListener(mOnScrollChangedListener);
          }
  
          @Override
          public void onStop() {
          swipeRefreshLayout.getViewTreeObserver().removeOnScrollChangedListener(mOnScrollChangedListener);
          super.onStop();
          }
  </code></pre>
  <p>It works on some website, but in my web that based on Odoo it still can't work</p>