从一个页面导航到另一个xamarin表单

时间:2018-03-28 12:44:36

标签: android xamarin xamarin.forms xamarin.android xamarin-studio

我正在开发Xamarin表单PCL项目,我想在我的项目中实现一个启动画面。我按照下面的例子来了解Xamarin.android部分 xamarin forms splash screen android

当我从一个页面导航到另一个页面时,页面之间会显示启动画面。针对上述问题的任何解决方案。

splash_screen.xml

<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="fill_horizontal|fill_vertical"
android:src="@drawable/SplashScreen" 

SplashActivity.cs

[Activity(Label = "sso_app_1", Icon = "@drawable/icon", Theme = "@style/MyTheme",
          MainLauncher = true, NoHistory = true,
          ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class SplashActivity : Android.Support.V7.App.AppCompatActivity
{
    protected override void OnResume()
    {
        base.OnResume();
        StartActivity(new Intent(Application.Context, typeof(MainActivity)));
    }
}

style.xml

<style name="MyTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
    <item name="windowNoTitle">true</item>
    <!--We will be using the toolbar so no need to show ActionBar-->
    <item name="windowActionBar">false</item>
    <!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette-->
    <!-- colorPrimary is used for the default action bar background -->
    <item name="colorPrimary">#2196F3</item>
    <!-- colorPrimaryDark is used for the status bar -->
    <item name="colorPrimaryDark">#1976D2</item>
    <!-- colorAccent is used as the default value for colorControlActivated
     which is used to tint widgets -->
    <item name="colorAccent">#FF4081</item>
    <!-- You can also set colorControlNormal, colorControlActivated
     colorControlHighlight and colorSwitchThumbNormal. -->
    <item name="windowActionModeOverlay">true</item>
    <item name="android:windowBackground">@drawable/splash_screen</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowActionBar">true</item>
    <item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
</style>

0 个答案:

没有答案