【发布时间】:2018-06-08 15:58:24
【问题描述】:
我正在尝试在 Xamarin Forms 3.0.0.530893 中创建一个弹出页面。我使用 Rg.Plugins.Popup v.1.1.4.158-pre 并在 Android 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 ();
}
}
这里我在MainActivity OnCreate中为Android初始化插件
Rg.Plugins.Popup.Popup.Init(this,bundle);
我这里推送页面
Navigation.PushPopupAsync(new SignOutPopup());
【问题讨论】: