Skip to content
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

Merged
merged 6 commits into from
Mar 22, 2023
Merged

Conversation

hartez
Copy link
Contributor

@hartez hartez commented Feb 25, 2023

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

@Eilon Eilon added the area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter label Feb 28, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines.

@hartez hartez marked this pull request as ready for review March 14, 2023 23:02
@github-actions
Copy link
Contributor

Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines.

@rmarinho rmarinho self-requested a review March 21, 2023 18:17
Copy link
Contributor

@tj-devel709 tj-devel709 left a 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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Member

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";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmarinho rmarinho merged commit fc786dd into main Mar 22, 2023
@rmarinho rmarinho deleted the fix-13498 branch March 22, 2023 11:47
@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2023
@Eilon Eilon added area-controls-scrollview ScrollView and removed area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter labels May 14, 2024
@samhouts samhouts added the fixed-in-8.0.0-preview.3.8149 Look for this fix in 8.0.0-preview.3.8149! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-scrollview ScrollView fixed-in-8.0.0-preview.3.8149 Look for this fix in 8.0.0-preview.3.8149!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong height for Label placed inside a Scrollview
7 participants