1
votes

I am using ImageCircle plugin for xamarin forms and it works well sometimes, when the picture is a kind of square... But, when it's a rectangle, my image is resized and it's not that I planned what Can I do to the image stop resize?

my code

        <controls:CircleImage WidthRequest="75" HeightRequest="75" Grid.Row ="0" Grid.Column="1" Source="cadastrarPhoto.png"  x:Name="cadastrar_foto_perfil">

I seted a fix height and width as you can see, but it didn't solve my problem, maybe because this circle image is a child of a grid and its grandfather (lol) is a relative layout but I really don't know if WidthRequest can change because of that...

How it always should be

enter image description here

How it is when the image is a rectangle:

enter image description here

EDIT--------------------------------------------- I put it in a Stach layout and I defined Aspect as fit...it helped but didnt solve...

 <StackLayout Orientation="Horizontal" HorizontalOptions="Center" WidthRequest="75" HeightRequest="75" Grid.Row="0" Grid.Column="1">
      <controls:CircleImage Aspect="AspectFit" VerticalOptions="EndAndExpand" HorizontalOptions="EndAndExpand" Source="cadastrarPhoto.png" x:Name="cadastrar_foto_perfil">
        <controls:CircleImage.GestureRecognizers>
          <TapGestureRecognizer Tapped="ChamaPickerImage"/>
        </controls:CircleImage.GestureRecognizers>
      </controls:CircleImage>
    </StackLayout>
3
Did you tried set Aspect="AspectFit" to your image control?Diego Rafael Souza
Yeah...I will post more about my code here...cause I updated itJoyce de Lanna
your controls:CircleImage's verticaloptions and horizontaloptions are wrong. they're set to expand, so the image will fill available space.Slepz
which version of ImageCircle plugin are you using?Sharada Gururaj
I am having a hard time recreating this issue - is only background in this control stretched or entire image? The reason I ask is it could be parent control's background that might be culprit here - for eg Frame with circular radius.Sharada Gururaj

3 Answers

0
votes

I changed the api that I was using. Now I use ffimage

0
votes

Setting your HorizontalOptions="EndAndExpand" is what is causing you issues.

Instead, try setting both HorizontalOptions and VerticalOptions to a vaule that doesn't expand (Start, Center, End)

Note: I've noticed that you actually have to explicitly set HorizontalOptions to something that doesn't expand in order to get iOS to avoid stretching your CircleImage. Simply leaving it blank will default to stretching the image.

0
votes

In the image, instead of HorizontalOptions="EndAndExpand" or VerticalOptions="EndAndExpand", just set it as "Start", "Center" or "End".

By default if you set it as "xxExpand" or do not set it at all, Xamarin iOS expands the image...