【发布时间】:2016-12-06 10:37:54
【问题描述】:
在 Xamarin.form Xaml 中:当我给 AbsoulteLayout layoutBounds(.5,.5,.5,.5) 时,它会出现在中心位置,但不适用于 ios ......如果我使用的是 (.75,. 75,.5,.5) 它在 Xamarin 表单 xaml 页面中为 ios 而不是 android 的中心出现.....如何为 ios 和 android 设置相同的 layoutBounds
举个例子:
<AbsoluteLayout BackgroundColor="#99000000"
HorizontalOptions="FillAndExpand"
IsVisible="{Binding xyz}"
VerticalOptions="FillAndExpand">
<AbsoluteLayout x:Name="xyz"
AbsoluteLayout.LayoutBounds="0.5, 0.5, 0.5, 0.5"
AbsoluteLayout.LayoutFlags="All"
BackgroundColor="Transparent"
HorizontalOptions="CenterAndExpand"
VerticalOptions="CenterAndExpand" />
</AbsoluteLayout>
【问题讨论】:
-
把你的整个例子。如果不设置
Width/Height,我无法看到内部AbsoluteLayout。如果我将内部AbsoluteLayout更改为Frame并设置一些背景,那么我可以看到内部内容,并且它位于两者的中心。你能告诉我你如何设置内部AbsoluteLayout的大小吗? -
@EgorGromadskiy 我们正在使用 HeightRequest/WidthRequest 手动设置高度和宽度,并将该布局动态添加到内部绝对布局。有什么方法可以在不使用 OnPlatform 的情况下实现,以便它适用于所有平台。
-
标签: xaml layout xamarin xamarin.forms