Xamarin Forms中的模态页面

3

欢迎来到SO。我鼓励您首先尝试具体实现您想要做的事情,因为这既证明了您已经完成了必要的背景研究,也澄清了您的问题。 - rchang
3个回答

2

Xamarin.Forms中的标准模态框不能是透明的。您需要创建自己的视图。


1

在您想要模式窗口出现的地方插入一个绝对视图!

<AbsoluteLayout  xmlns="http://xamarin.com/schemas/2014/forms" 
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="className">
    <!-- Transparent Background -->
    <StackLayout AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
                 AbsoluteLayout.LayoutFlags="All"
                 BackgroundColor="Gray"
                 Opacity="0.5"
                 >
    </StackLayout>

    <!-- Content -->
    <ContentView x:Name="Overlay"
                 AbsoluteLayout.LayoutBounds="0.5, 0.5, 0.5, 0.5"
                 AbsoluteLayout.LayoutFlags="All"
                 BackgroundColor="Transparent"
                 Padding="10, 0">
        <Frame Opacity="1">
           <Label Text="myLabel"/>
            </StackLayout>
        </Frame>
    </ContentView>
</AbsoluteLayout>

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接