Reputation: 186
I'm new to Xamarin Android development. I'm following the Microsoft Splash Screen tutorial: https://learn.microsoft.com/en-us/xamarin/android/user-interface/splash-screen
I have got the error saying The AppTheme.Base not found
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="MyTheme" parent="AppTheme.Base"></style>
<style name="MyTheme.Splash" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowActionBar">true</item>
</style>
Upvotes: 0
Views: 3508
Reputation: 14956
you could try this:
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="MyTheme" parent="AppTheme"></style>
<style name="MyTheme.Splash" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowActionBar">true</item>
</style>
then use @style/MyTheme
Upvotes: 0
Reputation: 24460
If you look in the sample they link at the bottom of the page you link to, you can see that they have changed the naming a bit in their resource file. They also switch the names out later in the doc, which is a bit confusing. https://github.com/xamarin/monodroid-samples/blob/master/SplashScreen/SplashActivity/Resources/values/style.xml
You should be able to simply change AppTheme
to AppTheme.Base
in the XML you've shown and it should work. Given that you use MyTheme
in your Application node in the AndroidManifest and MyTheme.Splash
in your SplashActivity.
Upvotes: 1