Swipe Refresh WebView In sketchware

1) Create a new sketchware project.

2) Drag and Drop a Linear Layout with id linear1 and height match_parent.

3) Drag and Drop a WebView with id wb inside that Linear Layout linear1.

4) Enable the AppCompat and Design Library.

5) In Oncreate event do as below:-

6) Code used in ASD block is :-

final android.support.v4.widget.SwipeRefreshLayout sr = new android.support.v4.widget.SwipeRefreshLayout(this);
sr.setLayoutParams(new LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams.MATCH_PARENT, android.widget.LinearLayout.LayoutParams.MATCH_PARENT));
linear1.post(new Runnable() { @Override public void run() {sr.addView(wb); } });
wb.setWebViewClient(new WebViewClient() { public void onPageFinished(WebView view, String url) {
sr.setOnRefreshListener( new android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener() {
@Override public void onRefresh() { wb.reload();

That’s All.
Save and run Project..

Leave a Comment