使用以下教程添加启动画面后,我的PCL中的选项卡页面不会显示在应用程序中。它只加载第一个Web视图,而不显示所有其他选项卡:
https://xamarinhelp.com/creating-splash-screen-xamarin-forms/
我在项目中添加的是styles.xml文件:
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="splashscreen" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/splash</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
</resources>
这是在[Activity]:
下的MainActivity.cs文件中Theme = "@style/splashscreen"
它加载启动画面很好,问题是它不再显示标签,这个应用程序有每个标签的Web视图,但它只显示第一个Web视图。
是因为主题吗?我该如何解决?
编辑:
选项卡页面在PCL类中定义,因为它也将在iOS上使用。
标签页来自PCL类:
App.cs:
using System;
using Xamarin.Forms;
namespace WorkingWithWebview
{
public class App : Application // superclass new in 1.3
{
public App ()
{
var tabs = new TabbedPage ();
//tabs.Children.Add(new DriveBuy { Title = "Drive Buy" });
tabs.Children.Add(new UsedCS { Title = "Used Car Search" });
tabs.Children.Add(new Classifieds { Title = "Classifieds" });
tabs.Children.Add(new NewCS { Title = "New Car Search" });
tabs.Children.Add(new NewCarSp { Title = "New Car Specials" });
tabs.Children.Add(new NewCarPL { Title = "New Car Price List"
});
tabs.Children.Add(new NEWS { Title = "Motoring NEWS" });
tabs.Children.Add(new CallMeBack { Title = "Call me Back" });
MainPage = tabs;
}
}
}
答案 0 :(得分:3)