-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Padding on ImageButtons works wrong on Android #13101
Comments
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
Verified this on Visual Studio Enterprise 17.7.0 Preview 2.0. Repro on Android 13.0-API33 with below Project: |
This issue should have been fixed by #14905 |
We found a workaround for our use case by using Aspect="Center" for the ImageButton which scales correctly for only a simple image inside an ImageButton. Not sure if this is a fix for any use case but I guess it's worth trying. |
I can still observe the issue with newest version of Maui (8.0.10) |
Wow @samtun - Aspect="Center" works. This is a good workaround. Thanks for sharing. @jsuarezruiz This issue still exists in Maui 8.0.10. |
I'm trying to use it with Maui 8 but Padding works only on Windows, not on Android |
It's still not working on Maui 8.0.21 either. (Aspect="Center" is not working as a workaround) Hopefully this is fixed soon, a very essential one to get your imagebutton look well. Probably fixable by making a customhandler but it should work out of the box. |
Aspect="Center" does not workaround the bug. Rather, any change to the button at runtime will cause the XAML hot-reload to refresh the button, which then causes it to render correctly (!?!). However, after restarting the app, it's broken again. This bug was supposed to be fixed in #14905 but it either didn't work or was regressed. The PR #22298 supposedly fixes it again. This latter PR is tagged as both "fixed in 8.0.60" and "fixed in 9.0.0". The bug still exists in 8.0.80, so clearly it was not fixed in 8.0.60. Hopefully it's actually fixed in 9.0.0......... |
Very sad to see this state of basic controls not working properly in Maui. We are creating an app since last September and failed to ship an MVP because of cosmetic issues like this. Maui is a huge let down at this point. We will wait for .NET 9 at best and then we will never return to Maui. Thanks for this pathetic experience team :-) |
I have found a workaround to solve this problem. When changing the isVisible or Padding property, you can call UpdatePadding() in PlatformView There are 2 ways to do this:
|
+1 |
Still not fixed in .NET 9 |
Yep, confirmed that padding is still broken in the same way in .Net 9 (Microsoft.Maui.Controls 9.0.30) 0 Padding: 5 Padding (Hot Reload, before restarting app. This is the correct behavior): 5 Padding (after restarting app, incorrect behavior): The style applied in the above images:
(frustratingly, the border is also not working outside of Hot Reload 😞) CC @mattleibow @jsuarezruiz since you both worked on the PR that was supposed to fix this 😕 |
Just to update, the workaround posted above doesn't work on .Net 9. Or rather, it works about 25% of the time, seemingly at random. Changing the wait time does not change this. |
Description
If you add padding to an ImageButton on Android, not only a padding will be set, but also a margin with the size of the padding. The button will therefore become smaller due to the padding. To get the button back to the right size, you then need to set a margin with a negative size.
Steps to Reproduce
Link to public reproduction project repository
https://github.com/matzeteo/TestApps.git
Version with bug
8.0 (current)
Last version that worked well
Affected platforms
Android
Affected platform versions
Android 10.0 and up
Did you find any workaround?
Set a margin with the negative value of the padding. But that doesn't work for every Layout structure.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: