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
Fix TableView rendering on Android #19473
Conversation
Hey there @janusw! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
* issue dotnet#5924 / dotnet#19321 * note: the VerticalStackLayout is not necessary to reproduce the bug (but the proposed fix does not work when it's present)
* proposed by @Bennynation at: dotnet#5924 (comment) * only seems to work if the TableView is not encompassed by a VerticalStackLayout
9d67c5f
to
4aa4a39
Compare
@hartez @StephaneDelcroix Ping! This is a pretty bad blocker for me. The tests mostly look fine (except for one which apparently hasn't finished properly for some reason). |
@hartez is currently working on a variation based on this PR |
Awesome. 🥳 Thanks for the update! |
Most probably yes, but actually I couldn't really test the fix yet. I'm pretty surprised and disappointed that #19723 is not part of release 8.0.6. @jsuarezruiz Can you tell me why it wasn't included in that release? |
@@ -126,6 +126,21 @@ public override SizeRequest GetDesiredSize(double widthConstraint, double height | |||
return base.GetDesiredSize(widthConstraint, heightConstraint); | |||
} | |||
|
|||
protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec) |
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.
How did you reach the conclusion of this fix?
I think there's still some issues around our fix on this one. So, I'm curious to pick your brain how you got here.
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.
Actually the idea for this fix was initially posted by @Bennynation at #5924 (comment). Maybe he can tell us how he got there? (I only took his sketch and molded it into a PR.)
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.
I think I finally have a pretty good idea.
The problem stems from this line here
https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/widget/ListView.java;l=1321
When you have an AT_MOST measure, the listview will basically create a scrap copy of itself to measure which confuses the whole xplat system. Because it doesn't know that the platform is just creating an in memory listview to get a height measurement. The code here basically bypasses all of that.
Now just have to figure out if this solution makes things worse, better, or if there's a goldilocks version.
Closing in favor of Which is somewhat similar. |
Description of Change
This PR overrides the method
TableViewRenderer.OnMeasure
, in order to fix bad rendering of TableViews on Android (when custom cells are involved, e.g. with a Picker).Issues Fixed
Fixes #5924