Skip to content

[REGRESSION, 9.0.60 Android] Many labels are of wrong size #28928

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

Closed
janne-hmp opened this issue Apr 11, 2025 · 22 comments
Closed

[REGRESSION, 9.0.60 Android] Many labels are of wrong size #28928

janne-hmp opened this issue Apr 11, 2025 · 22 comments
Labels
area-controls-label Label, Span platform/android potential-regression This issue described a possible regression on a currently supported version., verification pending regressed-in-9.0.60 t/bug Something isn't working
Milestone

Comments

@janne-hmp
Copy link

Description

When upgrading from 9.0.50 to 9.0.60 several labels on Android, especially in titles, have started to malfunction by making the labels extremely narrow even though there is much space available. Windows and iOS seem to work properly.

Image

Image

Image

Steps to Reproduce

  1. Clone the reproduction repository
  2. Build GnollHackM according to instructions for Android
  3. Start the game and press About button on the starting screen
  4. The About title is one character wide on the page that opens
  5. Press Version page. Many labels on the page are of a random size and on several rows.

Link to public reproduction project repository

https://github.com/hyvanmielenpelit/GnollHackMAUIEasyBuild

Version with bug

9.0.60 SR6

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

9.0.50 SR5

Affected platforms

Android

Affected platform versions

Android 15

Did you find any workaround?

No, cannot upgrade to 9.0.60 on Android.

Relevant log output

@janne-hmp janne-hmp added the t/bug Something isn't working label Apr 11, 2025
@rmarinho rmarinho added the potential-regression This issue described a possible regression on a currently supported version., verification pending label Apr 11, 2025
@rmarinho rmarinho added this to the .NET 9 SR6 milestone Apr 11, 2025
@EricLVertiGIS
Copy link

EricLVertiGIS commented Apr 11, 2025

Could this PR introduced some sort of regression for Android Labels? https://github.com/dotnet/maui/pull/28215/files#diff-3cca9c2b3a116c764c1a2d6f117cf6329ac7ca15aa10438a86c8d9f47f220c50.

@PureWeen PureWeen modified the milestones: .NET 9 SR6, .NET 9 SR7 Apr 12, 2025
@LeoJHarris
Copy link

LeoJHarris commented Apr 16, 2025

This is a UI bug we have had to rollback on, its causing some of our page content to expand way beyond their expected sizes when they have nested labels

@TonyLugg
Copy link

Same issue here

1 similar comment
@omghb
Copy link

omghb commented Apr 18, 2025

Same issue here

@EricLVertiGIS
Copy link

Is there any expected release date for SR5.1 ? We cannot update to 9.0.60 due to the Android label regression mentioned in this ticket. We cannot revert to 9.0.50 because of the IsVisible regression on Windows. SR5.1 with the revert #28869 should be a stable version for us.

@TonyLugg
Copy link

I had to roll back too, my app has many strings and Android UI is now a disaster under 9.0.60.

@vecalion
Copy link

Did you guys find any workaround or just rolled back to the previous versions?

@janne-hmp
Copy link
Author

Did you guys find any workaround or just rolled back to the previous versions?

Just rolled back to 9.0.50 and waiting for the release of 9.0.70. Not sure if anything else can be done about this one.

@TonyLugg
Copy link

Did you guys find any workaround or just rolled back to the previous versions?

Just rolled back to 9.0.50 and waiting for the release of 9.0.70. Not sure if anything else can be done about this one.

Rolled back

@jackerman-cu
Copy link

jackerman-cu commented Apr 24, 2025

Did you guys find any workaround or just rolled back to the previous versions?

One workaround that has helped with specifically labels that only have one line of text (multi-line text is still an issue) is adding LineBreakMode="NoWrap".

EDIT: Looks like this workaround may rely on a few things. If you are wanting to use HorizontalOptions="End", use "HorizontalOptions="Fill" (should be default on a Label) and HorizontalTextAlignment="End" instead.

@Bamich
Copy link

Bamich commented Apr 25, 2025

Same problem.

Could this PR introduced some sort of regression for Android Labels? https://github.com/dotnet/maui/pull/28215/files#diff-3cca9c2b3a116c764c1a2d6f117cf6329ac7ca15aa10438a86c8d9f47f220c50.

Yes, that's it.

@rmarinho @jsuarezruiz @PureWeen
I checked, this PR causes this issue. Reverting fixes it.

@maonaoda
Copy link
Contributor

maonaoda commented Apr 27, 2025

When I switch Label.IsVisible from False to True, due to the changes introduced in #28215, the incorrect LineCount is being used in the OnMeasure method to calculate maxWidth. This happens because, when the label is not visible, it uses the incorrect LineCount. After switching IsVisible to True, OnMeasure is not triggered again, and as a result, the displayed content is incorrect.

Temporary Solution:
To address this, I'm temporarily resetting the Text of the label when IsVisible changes to True. This forces the OnMeasure method to be called again, which ensures that the correct LineCount is used, and the content is displayed properly.

                LabelHandler.Mapper.AppendToMapping<Label, ILabelHandler>(nameof(Label.IsVisible), static (handler, label) =>
                {
                    handler.UpdateValue(nameof(Label.Text));
                    handler.UpdateValue(nameof(Label.FormattedText));
                });
Before After
2025-04-27.16.19.01.mov
2025-04-27.16.20.37.mov

@sheiksyedm
Copy link
Contributor

@janne-hmp I believe this issue has been addressed by this PR #29210

@sheiksyedm
Copy link
Contributor

sheiksyedm commented Apr 28, 2025

@janne-hmp You can test this issue with the PR #29210 fix in your app by following the steps in this @jfversluis video: https://youtu.be/B2FOBjZKm9k?si=Yuy5stjb5HnG1kPp

@janne-hmp
Copy link
Author

Thanks for the note. There seems to be a YouTube video for everything these days.

@acaliaro
Copy link

acaliaro commented May 8, 2025

@jfversluis @jsuarezruiz do you know when SR7 will be released?

@PureWeen PureWeen closed this as completed May 8, 2025
@PureWeen
Copy link
Member

PureWeen commented May 8, 2025

@jfversluis @jsuarezruiz do you know when SR7 will be released?

we're targeting early next week

@janne-hmp
Copy link
Author

@PureWeen @jfversluis @jsuarezruiz This has not been fixed in 9.0.70. Several labels are still of the wrong size on Android, so we are still stuck with 9.0.50. Can you please reopen the issue, or shall I make a new regression issue for 9.0.70?

@TonyLugg
Copy link

@PureWeen @jfversluis @jsuarezruiz This seems like a fundamental flaw since 9.0.60. I tried reworking some of my layouts so that they would work in Android, but ended up reverting to 9.0.40 (my previous version) because I could not get wrapped labels to stop consuming the remaining space. Why is what worked in 9.0.40/50 not working since 9.0.60. I can't upgrade until this is fixed.

@Bamich
Copy link

Bamich commented May 24, 2025

Tested 9.0.70 on our project. The issue is still not resolved. Reverting this PR fixes the bug.

@bhavanesh2001
Copy link
Contributor

Tested 9.0.70 on our project. The issue is still not resolved. Reverting this PR fixes the bug.

If possible please log a new bug with a repro using 9.0.70

@sheiksyedm
Copy link
Contributor

@Bamich Hope this PR #29620 will resolved the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-label Label, Span platform/android potential-regression This issue described a possible regression on a currently supported version., verification pending regressed-in-9.0.60 t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests