C# 带有选项卡式主页的启动屏幕Xamarin表单
我是移动应用程序开发的初学者,我正在为一个项目使用Xamarin表单开发一个android应用程序 在我的Xamarin表单项目中,我必须在启动时添加一个启动屏幕。要实现这一点,我必须将此代码放在MainPage.XAML上C# 带有选项卡式主页的启动屏幕Xamarin表单,c#,android,xaml,xamarin.forms,C#,Android,Xaml,Xamarin.forms,我是移动应用程序开发的初学者,我正在为一个项目使用Xamarin表单开发一个android应用程序 在我的Xamarin表单项目中,我必须在启动时添加一个启动屏幕。要实现这一点,我必须将此代码放在MainPage.XAML上 <Grid> <!-- Place new controls here --> <Label Text="Welcome to Xamarin.Forms!" HorizontalOpti
<Grid>
<!-- Place new controls here -->
<Label Text="Welcome to Xamarin.Forms!"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand" />
<Grid x:Name="SplashGrid" BackgroundColor="{StaticResource Primary}">
<Image x:Name="Logo" Source="Logo" HorizontalOptions="Center" VerticalOptions="Center">
<Image.TranslationY>
<OnPlatform x:TypeArguments="x:Double">
<On Platform="Android">-12</On>
</OnPlatform>
</Image.TranslationY>
</Image>
</Grid>
</Grid>
我真的很感谢你的帮助。
提前感谢。通常,我们使用可绘制资源创建初始屏幕。遵循下面的STPE
public class App : Application
{
public App()
{
InitializeComponent();
}
protected override async void OnStart()
{
// show the splash
MainPage = new SplashPage();
// simple wait or initialize some services
await Task.Delay(2000);
// show the real page
MainPage = new NavigationPage(new TabbedPageContainer());
}
}
您可以在下面的链接上查看STPE。它在选项卡式页面上运行良好。
有关IOS的更多信息,请查看链接
我相信Splash是我们在应用程序加载第一页之前一直显示的东西,只是为了避免出现空屏幕,如果您在app.cs中分配Splash,那么它的工作方式将与第一页完全不同,实际上,启动时会出现空屏幕。@MShah请看一看问题:OP在主页上发布了带有启动图像的代码-但他不能再使用它了,因为现在应用程序正在使用带有TabbedPageContainer的NavigationPage,但可以做的是创建如下启动活动:以这种方式,它将作为启动屏幕并直接启动选项卡式页面only@MShahOP说:在我的Xamarin表单项目中,我必须在启动时添加一个启动屏幕。为了实现这一点,我必须将这段代码放在MainPage.XAML上——您可以自己发布答案,但对我来说,我的答案正是OP所要求的(页面上的飞溅图像)
public class App : Application
{
public App()
{
InitializeComponent();
}
protected override async void OnStart()
{
// show the splash
MainPage = new SplashPage();
// simple wait or initialize some services
await Task.Delay(2000);
// show the real page
MainPage = new NavigationPage(new TabbedPageContainer());
}
}