I've been working on getting our application to work with the ideas of Material Design, but also getting them to work in older versions of Android. Android's AppCompat library ships a theme, Theme.AppCompat.*
, which is supposed to standardize things somewhat.
So currently, I have the usual in values-v21\styles.xml
:
<style name="Theme.NW" parent="android:Theme.Material.Light.DarkActionBar">...</style>
I added the AppCompat package to the project. I finally figured out I needed to use the application styles instead of Android's ("@style/
" instead of "android:
"):
<style name="Theme.NW" parent="@style/Theme.AppCompat.Light.DarkActionBar">...</style>
Unfortunately, when I do this, I get a nasty exception:
Object reference not set to an instance of an object at Xamarin.Forms.Platform.Android.Platform.UpdateActionBarBackgroundColor () [0x00000] in [filename unknown]:0
at Xamarin.Forms.Platform.Android.Platform.set_CurrentNavigationPage (Xamarin.Forms.NavigationPage value) [0x00000] in [filename unknown]:0
at Xamarin.Forms.Platform.Android.Platform.UpdateActionBar () [0x00000] in [filename unknown]:0
at Xamarin.Forms.Platform.Android.Platform.SetPage (Xamarin.Forms.Page newRoot) [0x00000] in [filename unknown]:0
at Xamarin.Forms.Platform.Android.FormsApplicationActivity.InternalSetPage (Xamarin.Forms.Page page) [0x00000] in [filename unknown]:0
at Xamarin.Forms.Platform.Android.FormsApplicationActivity.SetMainPage () [0x00000] in [filename unknown]:0
at Xamarin.Forms.Platform.Android.FormsApplicationActivity.LoadApplication (Xamarin.Forms.Application application) [0x00000] in [filename unknown]:0
at NW.Mobile.Droid.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x001ac] in /Users/geoff/MyProject.Mobile/Android/MainActivity.cs:66
Has anyone had success in doing this?