-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure an exact measure for the nested horizontal scrollview #13554
Conversation
Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines. |
Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -2,6 +2,7 @@ | |||
using Android.Animation; | |||
using Android.Content; | |||
using Android.Graphics; | |||
using Android.Hardware.Lights; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this happens to me sometimes, is VS is adding this without us noticing ?
@@ -301,6 +310,7 @@ protected MauiHorizontalScrollView(IntPtr javaReference, JniHandleOwnership tran | |||
public MauiHorizontalScrollView(Context? context, MauiScrollView parentScrollView) : base(context) | |||
{ | |||
_parentScrollView = parentScrollView; | |||
Tag = "Microsoft.Maui.Android.HorizontalScrollView"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like its for the tests: https://github.com/dotnet/maui/pull/13554/files#diff-e047a3b468635cce7361a6c1bef5be0c7b6a8cce9f8662d737577ea66e34a844R115
(Line 115 in the test below)
Description of Change
The MauiScrollView knows what height the nested HorizontalScrollView should be, but the default measurement system just sees it as vertical ScrollView content and measures it with MeasureSpecMode.Unspecified. Which means that it only gets a MeasuredHeight as tall as the content, despite the fact that it may be laid out at a greater height.
We can fix this by adding a MeasureSpecMode.Exactly measure at the target height right before laying out the HorizontalScrollView.
Marking this as a draft right now, it needs device tests. Plus, we could probably check the MeasuredHeight/Width of the HorizontalScrollView before doing the exact measure to determine if we really need the extra measure call (we don't need it unless the measured size is less than the target layout size).
Issues Fixed
Fixes #13498