-
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
Span LineHeight Wrong on Android #19592
Labels
area-controls-label
Label, Span
fixed-in-8.0.20
fixed-in-8.0.40
platform/android 🤖
s/triaged
Issue has been reviewed
s/verified
Verified / Reproducible Issue ready for Engineering Triage
t/bug
Something isn't working
Milestone
Comments
Pretty ugly workaround to remove the private static void ConfigureLabelSpanLineHeightFix()
{
//
// This is a fix for labels that have spans with a LineHeight > 0.
// This tracks issue: https://github.com/dotnet/maui/issues/19592
//
Microsoft.Maui.Handlers.LabelHandler.Mapper.AppendToMapping( "FixFirstLevelSpans", ( handler, label ) =>
{
if ( label is Label rockLabel )
{
var spansWithLineHeight = rockLabel.FormattedText?.Spans?.Where( s => s.LineHeight > 0 );
var lineHeightBacking = 1d;
if ( spansWithLineHeight == null )
{
return;
}
foreach ( var span in spansWithLineHeight )
{
if ( span.LineHeight > lineHeightBacking )
{
lineHeightBacking = span.LineHeight;
}
span.LineHeight = 1;
}
rockLabel.LineHeight = lineHeightBacking;
}
} );
} |
Verified this on Visual Studio Enterprise 17.9.0 Preview 3(8.0.3 and 7.0.101). Repro on Android 14.0-API34, not repro on Windows 11, iOS 17.0 and MacCatalyst with below Project: |
kubaflo
added a commit
to kubaflo/maui
that referenced
this issue
Feb 4, 2024
kubaflo
added a commit
to kubaflo/maui
that referenced
this issue
Feb 4, 2024
kubaflo
added a commit
to kubaflo/maui
that referenced
this issue
Feb 5, 2024
kubaflo
added a commit
to kubaflo/maui
that referenced
this issue
Feb 5, 2024
PureWeen
pushed a commit
that referenced
this issue
Apr 1, 2024
* [Android] Fixed Wrong Span LineHeight (#19592) * Added a UI Test (#19592) * Added a null checking (#19592) * Updated the UiTest (#19592) * Added snapshot * Added Java native code * Improve Java code * call `context.getResources().getDisplayMetrics()` once * build `maui.aar` --------- Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com> Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
area-controls-label
Label, Span
fixed-in-8.0.20
fixed-in-8.0.40
platform/android 🤖
s/triaged
Issue has been reviewed
s/verified
Verified / Reproducible Issue ready for Engineering Triage
t/bug
Something isn't working
Description
When using a generic
Label
with aSpan
, theLineHeight
seems to be exponentially applied or something on Android.I understand that there are platform differences, but this behavior simply doesn't work and isn't usable. Is there something I'm misunderstanding or missing?
When the
![image](https://private-user-images.githubusercontent.com/11482832/292903046-7b205e48-d2ed-4af3-b6e7-caf1700958bd.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2MjM0MTgsIm5iZiI6MTcxOTYyMzExOCwicGF0aCI6Ii8xMTQ4MjgzMi8yOTI5MDMwNDYtN2IyMDVlNDgtZDJlZC00YWYzLWI2ZTctY2FmMTcwMDk1OGJkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI5VDAxMDUxOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWViM2VlZmVmMzdkYTRmN2QwMDM0MTBiYjk0NmZjYWE4YWI4MzMwOWY1Mzc5YWU0M2ZiNzYyYTA4ODM4ZmM0YTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.n10KwowCqmU7gvpxPULSs4-2ls_DsXzuOX0X2A65vUg)
LineHeight
is removed:Xamarin
In Xamarin, this works as intended:
![image](https://private-user-images.githubusercontent.com/11482832/292903477-dae4e229-dca5-4090-a9b0-5577ae7dc140.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2MjM0MTgsIm5iZiI6MTcxOTYyMzExOCwicGF0aCI6Ii8xMTQ4MjgzMi8yOTI5MDM0NzctZGFlNGUyMjktZGNhNS00MDkwLWE5YjAtNTU3N2FlN2RjMTQwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI5VDAxMDUxOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE0ZjY0Y2QxZDlkZjdhNzhlNzdlYzU1ZDhiNzI3MmNkMDk1YzdhNjg3MDcxMjExMmU5YmE4NjM5MWFlNmNmMzUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.IWAoy2pCjdVIdV7EbWx6HmHJGN-8bFKcr_CWrk5u52s)
Steps to Reproduce
Or
Link to public reproduction project repository
https://github.com/bradencohen/MauiRepros
Version with bug
8.0.3
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
Nope, but any ideas would be super appreciated.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: