Xamarin forms: Image is not showing in perfect circle - xamarin.forms

I already posted a question regarding this issue, never get any solution. So posting the same question with more details and findings.
For the circle images, I am using Xam.Plugins.Forms.ImageCircle nuget package in my project, which is working fine in android and windows but showing an oval shape in IOS, screenshot adding below.
Added ImageCircleRenderer.Init(); in AppDelegate.cs.
xmlns namespace added:
xmlns:controls="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions"
<controls:CircleImage
HorizontalOptions="Start"
VerticalOptions="Start"
Margin="0,0,0,-5"
WidthRequest="50"
Aspect="AspectFill"
BorderColor="#1C7DB4"
BorderThickness="2"
HeightRequest="50" />
Now I updated the Xam.Plugins.Forms.ImageCircle to 2.0.2 and the resulted image is adding below:
Thanks in advance

It looks as if you are displaying the circles in a ListView, which has a fixed height of the cells per default. It seems as if your cells are simply not high enough to give the CircleImages the space they need. You have two options to overcome this:
Set the cells heigth to a fixed value that is high enough.
I don't know the exact value of the cells padding, so you'll have to experiment a bit. Maybe start off with something around 60
<ListView RowHeight="60" ...>
Set HasUnevenRows="true"
I believe that this will fix the rows height automagically, but it comes at costs: There may be a negative impact on layouting your view.
<ListView HasUnevenRows="true">

Related

Why is the Xamarin linear progress bar cut in half when I set a corner radius on Android?

I am using the Syncfusion Xamarin ProgressBar with a corner radius (version 17.4.0.55):
<progressBar:SfLinearProgressBar
HeightRequest="16"
CornerRadius="16"
Progress="75"
ProgressColor="#FFffbe06"
TrackColor="#33ffbe06"
TrackHeight="16" />
On Android the corner radius applies to the middle of the bar in addition to the sides. It appears to cut the progress bar in two.
This problem does not exist on iOS.
I attempted to solve the issue by setting the SegmentCount to "1". But that did not solve the issue.
<progressBar:SfLinearProgressBar
...
SegmentCount="1" />
What do I need to update in my XAML to avoid the middle corner radius?
After review this using Syncfusion's example app, I discovered that there is a difference between running the app in Debug mode and Run mode. Here is an example of both modes:
The top image is in debug mode and you can see the little gap on it. The bottom one is in Run mode and it is a perfect progress bar.
Definitely is something that needs to be reported to Syncfusion as a bug.

Xamarin.Forms: Android picture renderer is basically useless

So, I am trying to achieve the effect as shown in this picture (regarding the party picture)
This is a snap shot from the iOS version of the app simply following this code:
<Image Source="{Binding picture}"/>
So, as you see, all thats needed to show this picture like this is one line of code (on iOS at least).
Cause this is what that will look like on Android:
So, youll see, it renderes it way too tiny, just inside a corner.
To get to (almost) the same results as on the iOS version, I have to alter the code like this:
<Image Source="{Binding picture}"
VerticalOptions="Start"
HorizontalOptions="StartAndExpand"
HeightRequest="171"/>
Giving it height values and so much more stuff, and in the end it still shows slight borders (about a pixel wide) and this is just a terrible solution.
What is the best way of showing the party image just the same as it is on the iOS version just on Android?
Why is Droid rendering the image tiner, not taking up all the space as iOS does?
There is an Aspect attribute inside Image. According to the official document, the default value of the Aspect attribute is AspectFit. You can auto-fill by setting the Aspect property to AspectFill. Here is the official document(https://learn.microsoft.com/en-us/dotnet/api/xamarin.forms.aspect?view=xamarin-forms)

Why does my Gatsby/Material-UI site render slightly larger than the viewport?

I am using the Gatsby/MUI starter as a boilerplate for my personal site. In my personal site, I am having the problem that all pages are rendering as slightly larger than the viewport size. This issue is consistent on mobile and laptop/desktop sized screens.
I am using MUI Grid. I have made sure that my meta viewport head element uses width=device-width. As far as I can tell this does not depend on fixed-size elements or grid spacing options, such as margin or padding.
Does anyone have any debug suggestions or would anyone like to see a particular piece of information that would aid in the debug process? Site is available at https://errcsool.com
My code is available here
Update: If I get rid of all pages except for index, this problem occurs as soon as I place something inside of an MUI with spacing options <Grid container spacing={x}>
Solved. Adding a root div element with padding at least half of spacing pixels, so for spacing={8}, the root div should have padding={32}.
This is well-known functionality of Material-UI Grid.
Related to this issue.

Xamarins Forms UWP App Images on scaled display

I have a laptop with a 4k display. The display properties are set to 3840 X 2160 (Recommended) for the resolution and the scale factor is set to 250% again, the recommended value. I have images in my project scaled with the following suffixes:
.scale-100.png
.scale-150.png
.scale-200.png
.scale-250.png
.scale-300.png
.scale-350.png
.scale-400.png
based on the documentation I found.
When I run the app, the images show up huge and throw the rest of the display off. Below is a screen shot:
if I set the scale to 100% - everything is tiny, but the images are correct. Here is a screen shot.
any idea how to fix this?
Derive from official document.
UWP image file names can be suffixed with .scale-xxx before the file extension, where xxx is the percentage of scaling applied to the asset, e.g. myimage.scale-200.png. Images can then be referred to in code or XAML without the scale modifier, e.g. just myimage.png. The platform will select the nearest appropriate asset scale based on the display's current DPI.
From your screen, it looks get the correct scale image, but your image control has been scale, Please try to set Aspect property as Fill for image control.
set the size on platform specific
OnPlatform is used to set specific value for each platform. For example
<StackLayout>
<StackLayout.Margin>
<OnPlatform x:TypeArguments="Thickness">
<On Platform="iOS" Value="0,20,0,0" />
<On Platform="Android, UWP" Value="0,0,0,0" />
</OnPlatform>
</StackLayout.Margin>
...
</StackLayout>
You could specific StackLayout margin for each platform like code above.

ToolbarItem is showing a spot instead of image?

I'm creating an app using Xamarin and I am trying to add a ToolbarItem with icon, on Android it works fine but on iOS it just show a white spot as can see in the image below and I don't know why it is happening.
How could I fix this ?
ToolbarItem
<ContentPage.ToolbarItems>
<ToolbarItem Icon="icon.png" />
</ContentPage.ToolbarItems>
Toolbar on iOS by default is showing only the colored alpha of the image. If you want to use the colored image you need to specify that the rendering mode of your asset is not default, but rather original.

Resources