-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Padding on ImageButtons works wrong on Android #13101
Copy link
Copy link
Labels
area-controls-buttonButton, ImageButtonButton, ImageButtonfixed-in-8.0.0-preview.5.8529Look for this fix in 8.0.0-preview.5.8529!Look for this fix in 8.0.0-preview.5.8529!platform/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
Description
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
- Create a new Maui App
- Create a Grid
- Add a ImageButton to the Grid
- Set a Padding on the ImageButton
- Add a Button to the Grid to see the Size difference
- It should be now like:
<Grid ColumnDefinitions="*,100,100,*" RowDefinitions="*,100,*">
<ImageButton Grid.Column="1" Grid.Row="1" Padding="10" BackgroundColor="Aqua" Source="dotnet_bot.png"/>
<Button Grid.Column="2" Grid.Row="1" Text="testButton" Padding="10" BackgroundColor="Blue" WidthRequest="100" HeightRequest="100"/>
</Grid>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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-controls-buttonButton, ImageButtonButton, ImageButtonfixed-in-8.0.0-preview.5.8529Look for this fix in 8.0.0-preview.5.8529!Look for this fix in 8.0.0-preview.5.8529!platform/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