问题描述
我已经发布了有关此问题的问题,但从未得到任何解决方案.因此,发布具有更多详细信息和发现的相同问题.
I already posted a question regarding this issue, never get any solution. So posting the same question with more details and findings.
对于圆形图像,我在项目中使用Xam.Plugins.Forms.ImageCircle nuget程序包,该程序在android和Windows上运行正常,但在IOS中显示为椭圆形,下面添加了屏幕截图.
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.
添加了ImageCircleRenderer.Init();在AppDelegate.cs中.
Added ImageCircleRenderer.Init(); in AppDelegate.cs.
添加了xmlns命名空间:
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" />
现在,我将Xam.Plugins.Forms.ImageCircle更新为2.0.2,结果图像添加到下面:
Now I updated the Xam.Plugins.Forms.ImageCircle to 2.0.2 and the resulted image is adding below:
预先感谢
推荐答案
看起来好像您在ListView
中显示圆圈,该圆圈默认具有固定的单元格高度.似乎您的单元格不够高,不足以为CircleImage
提供所需的空间.您有两种选择可以解决此问题:
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 CircleImage
s the space they need. You have two options to overcome this:
- 将单元格高度设置为足够高的固定值.
- 我不知道单元格填充的确切值,因此您必须进行一些实验.也许从60左右开始
- 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" ...>
- 设置
HasUnevenRows="true"
- 我相信这会自动确定行的高度,但这要付出代价:可能会对视图的布局产生负面影响.
<ListView HasUnevenRows="true">
这篇关于Xamarin形式:图像未显示为完整的圆圈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!