AppCompat support in MVVMCross Android splash screen

As it’s mentioned in MVVMCross documentation Android is quite specific in terms of navigation requirements. The entry point is statically indicated by MainLauncher = true attribute parameter on the activity. On rest of the platforms, specifically on iOS, this can be done dynamically by implementing IMvxAppStart class for registration in MvxApplication.Initialize().

To achieve this MVVMCross introduce a special lightweight type of activity - IMvxAndroidSplashScreenActivity. Unfortunately the default implementation does not support the features from MvvmCross.Droid.Support.V7.AppCompat like vector images or material design themes.

The workaround is pretty straightforward. MvxSplashScreenActivity can be rewritten to derive from MvxAppCompatActivity instead of MvxActivity:

public abstract class MvxSplashScreenAppCompatActivity
  : MvxAppCompatActivity<MvxNullViewModel>, IMvxAndroidSplashScreenActivity
      // ...

For rest of the code see the original class.

Happy coding!

Marek Mierzwa

Marek Mierzwa
Husband, father, spiritual journeyman and in the meantime a software developer

Setting tint color in Xamarin.Form image

Today's mobile apps are rarely created as text-only. Most of them needs at least in-app icons for toolbars. In many cases you can find gr...… Continue reading