Reputation: 117
I am a newbie to cross platform development and Xamarin Forms. My app takes about 5-6 seconds to load, meanwhile it has a white screen, I want to show the ActivityIndicator (or an image) instead of the white screen until it loads.
The first "activity" that loads is basic MainPage from demos The XAML:
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:App2.Views"
x:Class="App2.Views.MainPage">
<MasterDetailPage.Master>
<views:MenuPage />
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
<NavigationPage>
<NavigationPage.Icon>
<OnPlatform x:TypeArguments="FileImageSource">
<On Platform="iOS" Value="tab_feed.png"/>
</OnPlatform>
</NavigationPage.Icon>
<x:Arguments>
<views:ItemsPage />
</x:Arguments>
</NavigationPage>
</MasterDetailPage.Detail>
But I dont know where to put the ActivityIndicator
(or image), if I put it in the constructor of ItemsPage
, its already too late. Any suggestions?
EDIT:
added dependency for ACR User Dialogs and the line UserDialogs.Init(this);
to my Android MainActivity.cs , still nothing
Upvotes: 1
Views: 2294
Reputation: 700
Please follow this blog : "https://xamarinhelp.com/creating-splash-screen-xamarin-forms/" for adding splash screen in iOS and Android.
For your situation, splash screen should be the more suitable solution.
Upvotes: 0
Reputation: 90
You should use a splash screen, for Android platform you must implement it manually in your Android project. Here is a very good tutorial Xamarin.Forms (Android) And in iOS its built in, Just go to your iOS project, open info.plist file, in visual assets section set Launch Screen.
Upvotes: 1