-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[ImageButton][Android] Padding is incorrect after IsVisible is changed #18001
Copy link
Copy link
Closed
Labels
area-controls-buttonButton, ImageButtonButton, ImageButtonmigration-compatibilityXamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-ConvertXamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convertplatform/androids/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't workingSomething isn't working
Milestone
Metadata
Metadata
Assignees
Labels
area-controls-buttonButton, ImageButtonButton, ImageButtonmigration-compatibilityXamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-ConvertXamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convertplatform/androids/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't workingSomething isn't working
Type
Fields
Give feedbackNo fields configured for issues without a type.
Description
Hello, and thank you for this awesome framework.
I've noticed a bug where ImageButtons for Android does not correctly set their Padding. I first thought it happened every time you draw a ImageButton, but that was not the case. It happens whenever you change the IsVisible property, which in many cases people are I presume.
In the follow example I have a
ImageButtonwith thedotnet_botas source and a red background. I've set the Padding to50, which should make the bot smaller inside the button. This works the first time the app loads, but once I change the IsVisible (using theSwitch) it ignores the Padding.Screen.Recording.2023-10-13.at.13.56.55.mov
Steps to Reproduce
ImageButtonhas the correct padding once it loads.ImageButtonnot having the correct padding when you tap theSwitch.Link to public reproduction project repository
https://github.com/haavamoa/MauiApp/tree/task/hmo-imagebutton-padding-android
Version with bug
8.0.0-rc.2.9373
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
The way to get around this the issue where IsVisible is flipped is to make sure to update the padding after the IsVisible has changed:
Here is our fix, where we ship a wrapping ImageButton class.
Relevant log output
No response