I'm unable to find this info at https://developer.android.com/preview/api-overview.html
Thanks!
NestedScrollView is just like ScrollView, but it supports acting as both a nested scrolling parent and child on both new and old versions of Android. It is enabled by default. NestedScrollView is used when there is a need for a scrolling view inside another scrolling view.
android:nestedScrollingEnabled="true" in the nested (child) scrollable view, assuming you have one somewhere inside another. This causes the child view to scroll to completion, and then allow its parent to consume the rest of the scroll.
setnestedscrollingenabled set it to false.
They did not draw much attention to this great new feature. I've been toying with it, and I think I've figured it out. All you have to do is is set
android:nestedScrollingEnabled="true"
in the nested (child) scrollable view, assuming you have one somewhere inside another. This causes the child view to scroll to completion, and then allow its parent to consume the rest of the scroll. I found that I liked the opposite behavior better - parent gets scroll priority, then child follows - so I overrode the onNestedScroll
method in ScrollView as follows:
@Override public void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { //swap dyConsumed and dyUnconsumed super.onNestedScroll(target, dxConsumed, dyUnconsumed, dxUnconsumed, dyConsumed); }
You should use this new ScrollView subclass for the outer (parent) ScrollView.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With