我在彈出視窗中有兩個條目,但是當我給它焦點并出現鍵盤時,彈出視窗不會顯示,只有當您開始在條目中寫入文本并且鍵盤關閉時它才會出現位置

<?xml version="1.0" encoding="utf-8" ?>
<pages:PopupPage
x:Class="MyApp.Views.RgPluginsPopup"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:animations="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup"
xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup">
<pages:PopupPage.Animation>
<animations:ScaleAnimation
DurationIn="400"
DurationOut="300"
EasingIn="SinOut"
EasingOut="SinIn"
HasBackgroundAnimation="True"
PositionIn="Center"
PositionOut="Center"
ScaleIn="1.2"
ScaleOut="0.8" />
</pages:PopupPage.Animation>
<StackLayout HorizontalOptions="Center" VerticalOptions="Center">
<Frame
BackgroundColor="White"
CornerRadius="10"
HasShadow="False">
<StackLayout Spacing="20">
<Label
FontSize="16"
HorizontalOptions="Center"
Text="Please enter your credentials" />
<Entry Placeholder="Username" />
<Entry IsPassword="True" Placeholder="Password" />
<Button Text="Sign in" />
</StackLayout>
</Frame>
</StackLayout>
</pages:PopupPage>
uj5u.com熱心網友回復:
經過我的測驗,進入頁面時設定焦點可以解決這個問題。
這是xaml代碼:
<StackLayout HorizontalOptions="Center" VerticalOptions="Center">
<Frame
BackgroundColor="White"
CornerRadius="10"
HasShadow="False">
<StackLayout Spacing="20">
<Label
FontSize="16"
HorizontalOptions="Center"
Text="Please enter your credentials" />
<Entry Placeholder="Username" x:Name="test"/>
<Entry IsPassword="True" Placeholder="Password" />
<Button Text="Sign in" />
</StackLayout>
</Frame>
</StackLayout>
這是背景代碼:
public partial class Page1 : Rg.Plugins.Popup.Pages.PopupPage
{
public Page1()
{
InitializeComponent();
}
protected override void OnAppearing()
{
base.OnAppearing();
test.Focus();
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/459778.html
標籤:xml xamarin xamarin.forms 弹出窗口
