Skip to content
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

ImageButton wrong size and missing border on Android #25034

Closed
c-ody opened this issue Oct 1, 2024 · 6 comments
Closed

ImageButton wrong size and missing border on Android #25034

c-ody opened this issue Oct 1, 2024 · 6 comments
Labels
area-controls-button Button, ImageButton platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@c-ody
Copy link

c-ody commented Oct 1, 2024

Description

When you give an ImageButton a border, padding, and size requests, the border is not visible and the image is the wrong size. This happens on Android but not on iOS.

Steps to Reproduce

  1. Create a File > New .NET MAUI App
  2. Replace the contents of App() with below:
InitializeComponent();

var mainPage = new MainPage();
var btn = new ImageButton()
{
    Source = "dotnet_bot.png",
    WidthRequest = 150,
    HeightRequest = 150,
    BorderColor = Colors.Black,
    BorderWidth = 1,
    Padding = 20,
};

mainPage.Content = btn;
MainPage = mainPage;
  1. Observe the bug (image is wrong size and missing a border)

Expected outcome: The image has expected (larger) size and has a visible border.

Link to public reproduction project repository

No response

Version with bug

8.0.82 SR8.2

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 14 (Pixel Fold)

Did you find any workaround?

Do not set padding on the ImageButton

Relevant log output

No response

@c-ody c-ody added the t/bug Something isn't working label Oct 1, 2024
Copy link

We've found some similar issues:

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

@jfversluis
Copy link
Member

Can you maybe try the latest version 8.0.91 and let us know if it still is an issue there?

@jfversluis jfversluis added platform/android 🤖 s/needs-info Issue needs more info from the author area-controls-button Button, ImageButton labels Oct 2, 2024
@c-ody
Copy link
Author

c-ody commented Oct 2, 2024

Can you maybe try the latest version 8.0.91 and let us know if it still is an issue there?

It's still happening after updating all Maui packages to 8.0.91

@dotnet-policy-service dotnet-policy-service bot added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Oct 2, 2024
@Zhanglirong-Winnie Zhanglirong-Winnie added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Oct 14, 2024
@Zhanglirong-Winnie
Copy link

This issue has been verified using Visual Studio 17.12.0 Preview 2.1(8.0.91 & 8.0.82). Can repro this issue on android platform.

@kubaflo
Copy link
Contributor

kubaflo commented Oct 27, 2024

Hi! It seems to work in NET9
Image

@jsuarezruiz jsuarezruiz added s/try-latest-version Please try to reproduce the potential issue on the latest public version and removed s/needs-attention Issue has more information and needs another look labels Oct 28, 2024
@c-ody
Copy link
Author

c-ody commented Oct 31, 2024

It does seem to work in .NET 9 when I put the ImageButton in the XAML as you have. Thanks!

@c-ody c-ody closed this as completed Oct 31, 2024
@dotnet-policy-service dotnet-policy-service bot removed the s/try-latest-version Please try to reproduce the potential issue on the latest public version label Oct 31, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Dec 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-button Button, ImageButton platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants