framelayout - scrolling up in webview causes refresh by SwipeRefreshLayout -
i have webview inside framelayout, add tabs because creating browser. framelayout inside swiperefreshlayout.
the problem: whenever scroll content fast in webview, refresh icon appears behind toolbar. should happen when webview content @ top. has framelayout, when remove it, issue gone.
the layout looks this:
<swiperefreshlayout android:id="@+id/swiperefresh" android:layout_width="match_parent" android:layout_height="match_parent" > <framelayout android:id="@+id/webviewframe" android:layout_width="match_parent" android:layout_height="match_parent" > <webview android:id="@+id/webview" android:layout_width="match_parent" android:layout_height="match_parent" /> </framelayout> </swiperefreshlayout>
just implement fragment or activity viewtreeobserver.onscrollchangedlistener set listener webview.getviewtreeobserver().addonscrollchangedlistener(this);
in onscrollchanged() method this
@override public void onscrollchanged() { if (webview.getscrolly() == 0) { swipelayout.setenabled(true); } else { swipelayout.setenabled(false); } }
Comments
Post a Comment