0

I added web view to my android studio project(activity_main.xml).also added progress bar,swipe refresh layout also.So when scrolling web page three or four times,page goes top indefinitely.It doesn't stop at bottom.can help me to stop this headache.I added my xml code below.

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

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

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

            <ProgressBar
                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" />

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

        </LinearLayout>

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

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

<com.google.android.gms.ads.AdView 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" />
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Mr.Mark
  • 13
  • 5
  • Your webview is in a nestedScrollView. Which is why the issue occurs. And the question is a possible duplicate of https://stackoverflow.com/questions/33688701/webview-height-grows-indefinitely-inside-a-nestedscrollview. please refer it as well – Anjana Jun 12 '19 at 11:52
  • @Anjana Thank you for your answer..I will check – Mr.Mark Jun 12 '19 at 12:15

0 Answers0