Search code examples
androidxamarinportable-class-library

After adding Splash Screen, tabbed pages do not show up?


After adding a splash screen using the following tutorial, the tabbed pages from my PCL do not show up in the app. It only loads the first web view and does not show all the other tabs:

https://xamarinhelp.com/creating-splash-screen-xamarin-forms/

All I have added to the project is the styles.xml file:

<?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>

And this in the MainActivity.cs file under [Activity]:

Theme = "@style/splashscreen"

It loads the splash screen fine, the issue is that it does not show the tabs anymore and this app has web views for each tab, but it only shows the first web view.

Is it because of the theme? How do I fix it?

EDIT:

The tabbed pages are defined in the PCL class as this will be used on iOS as well.

The tabbed page comes from the PCL class:

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;
        }
    }
}

Solution

  • Your styling seems to be wrong. Please follow https://developer.xamarin.com/guides/android/user_interface/creating_a_splash_screen/ to create splashscreen