Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to use Progress bar ,Swipe refresh Layout and custom Web Page not available at the same activity in Android Studio - 2019

In this post we are going to show to How to use Progress bar(with counting) ,Swipe refresh Layout and Custom Web Page not available error page at the same activity in Android Studio.If you want to Swipe refresh layout and custom error page only,watch below 2 videos.
If you want to add progress bar also please look at final code in this blog post.


Web Page not available error in Android WebView(Custom Error page)



Pull to refresh in Webview
 
activity_webview.xml

 xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    androidx.swiperefreshlayout.widget.SwipeRefreshLayout
        android:id="@+id/swipe"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentTop="true"
            android:layout_centerInParent="true"
            android:orientation="vertical">

            
                android:id="@+id/liProgressContainer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                
                    android:id="@+id/progressBar"
                    style="@style/Widget.AppCompat.ProgressBar.Horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="#FFFFFF"
                    android:indeterminate="true" />

                
                    android:id="@+id/tvLoadingPercentage"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="#FFFFFF" />

            

            androidx.core.widget.NestedScrollView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_below="@id/liProgressContainer">

                
                    android:id="@+id/webView"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" />
            androidx.core.widget.NestedScrollView>
        
    androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

     xmlns:ads="http://schemas.android.com/apk/res-auto"
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        ads:adSize="BANNER"
        ads:adUnitId="ca-app-pub-3940256099942544/6300978111" />


This post first appeared on GleanPost, please read the originial post: here

Share the post

How to use Progress bar ,Swipe refresh Layout and custom Web Page not available at the same activity in Android Studio - 2019

×

Subscribe to Gleanpost

Get updates delivered right to your inbox!

Thank you for your subscription

×