首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Xamarin Forms Rg.Plugins.Popup

Xamarin Forms Rg.Plugins.Popup
EN

Stack Overflow用户
提问于 2018-06-06 20:39:06
回答 2查看 3.9K关注 0票数 2

我正在尝试在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());
EN

回答 2

Stack Overflow用户

发布于 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>

并且你的框架应该居中。

告诉我它是不是能用。

票数 0
EN

Stack Overflow用户

发布于 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);
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50720640

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档