android - SwipeRefreshLayout is not intercepting the MotionEvent of the NestedScrollingChild -
i using nestedscrollwebview (heavily influenced nestedscrollview), solves many of known issues associated using webview in coordinatorlayout.
<android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto"> <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/themeoverlay.appcompat.actionbar"> <framelayout android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_scrollflags="enteralways|scroll|snap"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" app:titletextappearance="@style/textappearance.appcompat.subhead" app:popuptheme="@style/themeoverlay.appcompat.light"/> <progressbar android:id="@+id/progressbar" android:layout_width="match_parent" android:layout_height="2dp" android:layout_gravity="bottom" android:visibility="gone" style="@style/widget.appcompat.progressbar.horizontal"/> </framelayout> </android.support.design.widget.appbarlayout> <android.support.v4.widget.swiperefreshlayout android:id="@+id/swiperefreshlayout" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <com.example.app.widget.nestedscrollwebview android:id="@+id/webview" android:layout_width="match_parent" android:layout_height="match_parent"/> </android.support.v4.widget.swiperefreshlayout> </android.support.design.widget.coordinatorlayout> the nestedscrollwebview works great appbarlayout , enteralways|scroll|snap scroll flags, not swiperefreshlayout.
i removed following line nestedscrollwebview:
setoverscrollmode(webview.over_scroll_never); which makes sure view not display on scroll indicators. want on scroll indicators appear, following circumstances should not occur on scroll enabled.
from understand swiperefreshlayout should intercept touch event causes refresh indicator dragged (based on implementation of onintercepttouchevent()). swiperefreshlayout denies requestdisallowintercepttouchevent() child has nested scrolling enabled; true nestedscrollwebview. therefore, these events should handled in following manner:
if return true
onintercepttouchevent(), child view handling touch events receivesaction_cancel, , events point forward sent parent'sontouchevent()method usual handling.
instead, behavior see swiperefreshlayout spy on touch events of nestedscrollwebview never intercepts them. evidenced fact nestedscrollwebview never receives action_cancel touch event, , continues receive subsequent events though swiperefreshlayout indicator being dragged down.
this demonstrated in following screenshot; shows indicator of swiperefreshlayout on scroll indicator of webview being displayed @ same time.
i cannot figure out why case. mentioned previously, swiperefreshlayout should work view has nested scrolling enabled, reason not work in case. issue?
update
i think has way nestedscrollwebview handles dispatchnestedpre... methods , fact passes entire motionevent super.ontouchevent() method. according documentation:
nested pre-scroll events nested scroll events touch intercept touch.
dispatchnestedprescrolloffers opportunity parent view in nested scrolling operation consume or of scroll operation before child view consumes it.
now have figure out how rework nestedscrollwebview handle these methods properly.

Comments
Post a Comment