AbsoluteLayout边界不能正确定位大于50的大小

时间:2016-12-13 21:09:40

标签: xamarin xamarin.forms

我有一个AbsoluteLayout,我正在尝试嵌入BoxView。

我通过以下方式分配BoxView的定位:

AbsoluteLayout.SetLayoutFlags(WordThrottle, AbsoluteLayoutFlags.PositionProportional);
AbsoluteLayout.SetLayoutBounds(WordThrottle, new Rectangle(1.0, 1.0, 70, 70));

但是当我检查结果时,我得到了这个: enter image description here

而不是:

enter image description here

(第二张图片大小为50x50)

大于50的尺寸在屏幕上似乎也没有任何差异。我在这里缺少什么?

编辑:这是WordThrottle的声明:

<AbsoluteLayout BackgroundColor="Green">
    <mr:BoxView x:Name="WordThrottle" Color="Yellow" WidthRequest="50" HeightRequest="50" VerticalOptions="Start" HorizontalOptions="Start" />
</AbsoluteLayout>

1 个答案:

答案 0 :(得分:0)

试试这个

AbsoluteLayout.SetLayoutFlags(WordThrottle, AbsoluteLayoutFlags.PositionProportional);
AbsoluteLayout.SetLayoutBounds(WordThrottle, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));