我正在尝试在Xamarin Forms 3.0.0.530893中创建一个弹出页面。我使用了Androidv.1.1.4.158-pre,并在Rg.Plugins.Popup 8.0.0上进行了测试。但无论我在水平和垂直选项中放置什么,弹出窗口都显示在左上角。
这里是我的弹出式页面
<?xml version="1.0" encoding="utf-8" ?>
<pages:PopupPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ScanApp.Page.Popup.SignOutPopup"
xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup">
<StackLayout BackgroundColor="White" HorizontalOptions="Center" VerticalOptions="Center">
<Label Text="Log ud" TextColor="Black"></Label>
<Label Text="AutomationProperties du sikker på du ønsker at logge ud?"></Label>
<Button Text="LOG UD"></Button>
<Button Text="ANNULLER"></Button>
</StackLayout>
</pages:PopupPage>
,这是后端
using Rg.Plugins.Popup.Pages;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace ScanApp.Page.Popup
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class SignOutPopup : PopupPage
{
public SignOutPopup ()
{
InitializeComponent ();
}
}
Rg.Plugins.Popup.Popup.Init(this,bundle);
在这里我推送页面
Navigation.PushPopupAsync(new SignOutPopup());
发布于 2018-06-07 23:47:11
我不确定这个插件是如何工作的,但我已经在过去的一个项目中使用过它,下面是我所做的:
我建议你这样定义你的页面。将你的堆栈布局嵌入到一个“全屏”框架中,并为你的框架设置一些边距和边距:
<?xml version="1.0" encoding="utf-8" ?>
<pages:PopupPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ScanApp.Page.Popup.SignOutPopup"
xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"
>
<Frame HorizontalOptions="Center" VerticalOptions="Center"
BackgroundColor="White" Margin="20" Padding="20">
<StackLayout>
<Label Text="Log ud" TextColor="Black"></Label>
<Label Text="AutomationProperties du sikker på du ønsker at logge ud?"></Label>
<Button Text="LOG UD"></Button>
<Button Text="ANNULLER"></Button>
</StackLayout>
</Frame>
</pages:PopupPage>
并且你的框架应该居中。
告诉我它是不是能用。
发布于 2018-06-08 15:58:24
问题不在于插件或弹出页面。问题是,我在安卓MainActivity中输入了这些行,让应用程序填满整个屏幕
if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop)
{
Window.AddFlags(WindowManagerFlags.LayoutNoLimits);
Window.AddFlags(WindowManagerFlags.LayoutInScreen);
Window.DecorView.SetFitsSystemWindows(true);
}
https://stackoverflow.com/questions/50720640
复制相似问题