Skip to content

ImageButton dosen't scale Image correctly #25558

@FabianDeDe

Description

@FabianDeDe

Description

The ImageButton scales images wrong on Android, based on their height.

Under Windows this works fine.

I have not yet tested this on iOS.

Here are two screenshots, for reference I have added a normal button with the same image above the ImageButton.

<VerticalStackLayout
 Padding="30,0"
 Spacing="25">

    <Button ImageSource="xamarin_logo.png" BackgroundColor="Blue"/>

    <ImageButton Source="xamarin_logo.png" BackgroundColor="Blue"/>

</VerticalStackLayout>

The normal button scales the image properly.

The image used is 880x202p.

Windows:
Image

Android:
Image

As you can see on Windows the scaling behaviour is the same, under Android it is not.
It appears to keep the height (202p) of the image and only scales the width.

An issue similar to this seems to have already been fixed for the regular button, however, on the ImageButton this problem persists.
#9734

Steps to reproduce

This is the app used in the example:
https://github.com/FabianDeDe/MAUI-ImageButton-Issue-Repro.git

I made a new MAUI app, removed the default hello world app code and added a Button and an ImageButton along with a picture, which is in Maui1\Resources\Images. (As seen in the code snippet above the screenshots)

Version with bug

8.0.82

Affected platform

Android

Platform version

33

Did you find any workaround?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-buttonButton, ImageButtonpartner/syncfusionIssues / PR's with Syncfusion collaborationplatform/androids/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions