Display loading page over WebView while loading

To display a page with a text and image over the WebView while it is loading, follow the steps given below.

1. Create a new project in Sketchware.

2. In main.xml, add a LinearV linear1.
* Inside linear1 add a WebView webview1. Set height of webview1 to wrap_content.
* Below webview1 add another LinearV linear2.
* For linear1 set padding to 0.
* Inside linear2 add ImageView imageview1, and a TextView textview1.
* For linear2 set gravity to center_horizontal, center_vertical, and alpha to 0.5.
* For webview1 change height to match_parent.

3. Switch On AppCompat and Design.

4. In MainActivity.java, create a more block extra. In this more block declare a RelativeLayout rl and a SwipeRefreshLayout srl, using following codes.
}

RelativeLayout rl;
androidx.swiperefreshlayout.widget.SwipeRefreshLayout srl;

{

5. In onCreate event use following codes and blocks.
a. In an add source directly block put following codes:
rl = new RelativeLayout(this);
RelativeLayout.LayoutParams lparams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
rl.setLayoutParams(lparams);

linear1.removeAllViews(); linear1.addView(rl);

srl = new androidx.swiperefreshlayout.widget.SwipeRefreshLayout(this);

rl.addView(srl);
rl.addView(linear2);

srl.addView(webview1);

srl.setOnRefreshListener( new androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {

b. In webview1 load webview1 getURL, and make linear2 VISIBLE.

c. In an add source directly block put following codes.
}});

d. For webview1 set Cache mode to LOAD_CACHE ELSE NETWORK.

e. In webview1, load the desired url and make linear2 VISIBLE.

6. In onBackPressed event, if webview1 can go back use webview1 goBack block and make linear2 VISIBLE, else Finish Activity. See image below.

7. In webview1 onPageStarted event, make linear2 VISIBLE.

8. In webview1 onPageFinished event, make linear2 GONE, and for SwipeRefreshLayout set refreshing to false. See image below.
The code used here is
srl.setRefreshing(false);

9. Save and the project.

Comments

  1. Need The To Hire A Hacker❓ Then contact PYTHONAX✅

    The really amazing deal about contacting PYTHONAX is that the Hack done by us can’t get traced to you, as every Hacking job we do is strongly protected by our Firewall. It’s like saying if anyone tries to trace the Hack, it will lead them to us and we block whatever actions they are doing.

    We have been Invisible to Authorities for almost a decade now and if you google PYTHONAX, not really about us comes out, you can only see comments made by us or about us.

    Another Amazing thing to you benefit from Hiring our Hackers is that you get a Legit and the best Hacking service, As we provide you with Professional Hackers who have their Hacking Areas of specialization.
    We perform every Hack there is, using special Hacking tools we get from the dark web.

    Some list of Hacking Services we provide are-:
    ▪️Phone Hacking & Cloning ✅
    ▪️Computer Hacking ✅
    ▪️Emails & Social Media Account Hacking✅
    ▪️Recovering Deleted Files✅
    ▪️Tracking & Finding People ✅
    ▪️Hunting Down Scammers✅
    ▪️Hack detecting ✅
    ▪️Stealing/Copying Files & Documents From Restricted Networks and Servers ✅

    OTHER SPECIAL HACKING SERVICES

    ▪️Binary Option Recovery ✅
    ▪️Scam Money Recovery✅
    ▪️Bitcoin Multiplication✅
    ▪️Change Of Grades In Universities/Colleges ✅
    ▪️Phone Calls Monitoring✅
    ▪️keyLogging Installation✅
    ▪️Remote Access Trojan (RAT) installation ✅
    ▪️Cyber Security Upgrade✅
    ▪️And lots more...........

    Whatever Hacking service you require, just give us an Email using the Emails Address provided below.
    pythonaxhacks@gmail.com
    pythonaxservices@gmail.com

    PYTHONAX.
    2020 © All Right Reserved.

    ReplyDelete
  2. How to use it each time in the first click to show bottom navigation and in the second click to hide it?
    Thank you.

    ReplyDelete
  3. How to use when image clicked each time in the first click to show bottom navigation and in the second click to hide it?
    Thank you.

    ReplyDelete
  4. Bro help me.please how to fix this - firebase storage "Could not load files; quota has been exceeded for this project"

    ReplyDelete
    Replies
    1. Buy one of their plans or delete data from Firebase storage.

      Delete
  5. Sir, please help me.

    How can I make my app screen display responsive..it doesn't adapt and that sucks alot.

    Thanks.

    ReplyDelete
  6. How to Add shouldOverrideUrlLoading as WebView Event

    ReplyDelete
  7. How to create listview click to tab layout open.

    ReplyDelete

Post a Comment

Popular posts from this blog

Create Music Player app in Sketchware

A Flash Light App in Sketchware

In Sketchware: How to create a calculator for any simple formula?

Firebase auth in Sketchware for Login Activity

Simple car racing android game in Sketchware