Skip to content

ButtonImage width not sizing correctly #14346

@Qythyx

Description

@Qythyx

Description

In Android, ButtonImages incorrectly resize the width of the button to match the original width of the image.

The following code demonstrates the problem:

<Frame HeightRequest="50" Padding="0">
    <ImageButton
	    BackgroundColor="Transparent"
	    BorderColor="Red"
	    BorderWidth="2"
	    Aspect="AspectFit"
	    HorizontalOptions="Center"
	    VerticalOptions="Center"
	    Source="dotnet_bot.png" />
</Frame>

This generates the following result. You can see that the ImageButton is wider than it should be (the red outline). It seems this width is related to the width of the image asset (dotnet_bot).

image

Steps to Reproduce

See description above

Link to public reproduction project repository

n/a

Version with bug

6.0.312

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

all

Did you find any workaround?

A workaround is to use a normal Image with a tap gesture like this:

	<Image
		Source="icon_offers.png">
		<Image.GestureRecognizers>
			<TapGestureRecognizer Command="{Binding GotoOffers}" />
		</Image.GestureRecognizers>
	</Image>

Relevant log output

No response

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