Demonstrating bug when using collapsing toolbar in dialog #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds two menu items,
Broken Dialog
andFancy Dialog
. Those two open a dialog with an inflating view containing a coordinator layout with a collapsing toolbar withexitUntilCollapsed
.Fancy Dialog
uses a hack to fix the weird problem.In the screenshot below, you'll notice blank space below the recycler view. This was totally unexpected to me. That only occurs if the
CollapsingToolbarLayout
is usingexitUntilCollapsed
.I also added an
onMeasure()
count to the recycler view. It's called 36 times. And 28 in the "not broken" case, when I removeexitUntilCollapsed
or when I display theFancy Dialog
The dialog is in
wrap_content
for height, so it measures with anAT_MOST
height measure spec. I'm not sure where this remeasuring craziness comes from, but it might be the dialog trying to figure out how much it has to stretch. The CoordinatorLayout somehow decides that it doesn't need all the space the dialog can offer after all, and sets its height to the available height minus an empty space that is the height of the toolbar.My way around this problem was to change the
CoordinatorLayout
heightMeasureSpec
to be inEXACTLY
mode instead ofAT_MOST
.glhf