I have a strange issue with the CoordinatorLayout and the NestedScrollView (with the design support library 22.2.0)
Using a content smaller
The onMeasureChild() method is called many times during the layout process. Apparently, the key is getting a non-zero value for the child height early in the process. ScrollingViewBehavior fails to do so in the following:
int scrollRange = appBar.getTotalScrollRange();
int height = parent.getHeight()
- appBar.getMeasuredHeight()
+ scrollRange;
FixedScrollingviewBehavior fixes this with:
int height = parent.getHeight()
- appBar.getMeasuredHeight()
+ Math.min(scrollRange, parent.getHeight() - heightUsed);
which very early gives height the value of -128, the height of the app bar.
An alternative, close to the original is:
int height = parent.getMeasuredHeight()
- appBar.getMeasuredHeight()
+ scrollRange;