Open addisonElliott opened 5 years ago
@ceryle Any update here? This is something I would like to get to the bottom to, please
Decided to recreate this library and introduce changes and upgrades.
My library can be found here, I hope to keep it up-to-date and maintained.
Problem
When placing a
SegmentedButtonGroup
/SegmentedButton
within aNestedScrollView
, I am getting issues with the height not being set correctly even though thelayout_height
is set towrap_content
.Here is an example layout, you should be able to see the issue in the layout inspector.
Here is a screenshot of what I see in the layout inspector:
See that sliver up top, yeah that is it being cut off! Commenting out
NestedScrollView
makes it work.Solution
After some digging, I've found the culprit but I'm a bit confused by the source code so I need some assistance.
Regularly, the
SegmentedButton
will receive anonMeasure
with an AT_MOST spec for the height. In this instance, it will return the following. See here for codeIn a
NestedScrollView
, instead when sizing it doesonMeasure
with anUNSPECIFIED
andSegmentedButton
returns. See here for codeQuestions
@ceryle I am happy to submit a PR if we come to a conclusion for a fix.
Why does the AT_MOST return 2x padding for top/bottom while EXACTLY & UNSPECIFIED do not. This fixes the problem but I don't get the 2x so I was trying to understand.