[ImageButton][Android] Padding is incorrect after IsVisible is changed #18001
Labels
area-controls-button
Button, ImageButton
migration-compatibility
Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert
platform/android 🤖
s/triaged
Issue has been reviewed
s/verified
Verified / Reproducible Issue ready for Engineering Triage
t/bug
Something isn't working
Milestone
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
ImageButton
with thedotnet_bot
as 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
ImageButton
has the correct padding once it loads.ImageButton
not 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
The text was updated successfully, but these errors were encountered: