xaml - 使用 Xamarin.form Xaml 的 AbsoluteLayout.LayoutBounds 位置

标签 xaml layout xamarin xamarin.forms

在 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>

最佳答案

感谢您的回复。
我已经解决了绝对布局的中心对齐问题,希望对你有帮助

    <AbsoluteLayout Padding="0" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"    IsVisible="{Binding ShowPopup}">
        <BoxView Color="#99000000" AbsoluteLayout.LayoutBounds="0, 0, 1, 1" AbsoluteLayout.LayoutFlags="All" />
        <StackLayout x:Name="Popup" Padding="6" Orientation="Horizontal" BackgroundColor="Transparent" AbsoluteLayout.LayoutBounds="0.5, 0.5, -1, -1" AbsoluteLayout.LayoutFlags="PositionProportional">
        </StackLayout>
    </AbsoluteLayout>

关于xaml - 使用 Xamarin.form Xaml 的 AbsoluteLayout.LayoutBounds 位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38697307/

相关文章:

.net - 根据上下文值更改 DataGridCell 的背景颜色。 (WPF)

xaml - 我可以在 shell 中禁用汉堡包吗

wpf - 事件在 WPF 中不起作用

firefox - <a> 可以包含 HTML5 中的 &lt;footer&gt; 吗?

html - 文本区域列有多宽?

azure - 如何在 azure devops 中为带有引用的 dot net 项目的 xamarin 项目创建 YAML 构建管道

c# - 在 2 个不同的 xamarin 表单应用程序中共享本地 SQLite 数据库

c# - 如何通过 XAML 中的 CommandParameter 传递当前聚焦的元素名称?

Xamarin Android Profiler 无法启动 — "Deploy your app again with a newer version of Xamarin Studio"

css - 如何使 div 垂直填充其父元素?