Why the page is not updated and the swipe starts working from any scroll position, and not at the very top.
xml
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/swipe" android:layout_width="match_parent" android:layout_height="match_parent"> <WebView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/webView"> </WebView> </android.support.v4.widget.SwipeRefreshLayout> java
import android.os.Handler; import android.net.Uri; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.webkit.WebView; public class MainActivity extends AppCompatActivity implements SwipeRefreshLayout.OnRefreshListener { private SwipeRefreshLayout mSwipeLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WebView webView = (WebView) findViewById(R.id.webView); webView.setVerticalScrollBarEnabled(false); webView.setHorizontalScrollBarEnabled(false); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.getSettings().setSupportZoom(false); webView.getSettings().setSupportMultipleWindows(false); Uri data = getIntent().getData(); webView.loadUrl("http://google.com"); mSwipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipe); mSwipeLayout.setOnRefreshListener(this); mSwipeLayout.setColorSchemeResources( R.color.blue_swipe, R.color.green_swipe, R.color.orange_swipe, R.color.red_swipe); } @Override public void onRefresh() { new Handler().postDelayed(new Runnable() { @Override public void run() { // stop refresh mSwipeLayout.setRefreshing(false); } }, 3000); } }