Tuesday, November 26, 2013

Getting Support V7 working with MvvmCross

Recently Xamarin added Support V7 AppCompat and GridView to their Component store, which you now can use instead of ActionBarSherlock or LegacyBar and it is Google's official way to support ActionBar's on API's which natively do not support it. However it does not work straight out of the box and you need to mimic what MvxActivity does in your own implementation. So here's the code I used to re-create MvxActivity to inherit from ActionBarActivity instead of Activity, which Support V7 needs.

This way you only need to replace MvxActivity with MvxActionBarActivity where needed and also add one of the AppCompat Themes to your Activity: Theme = "@style/Theme.AppCompat.Light"

3 comments:

  1. Great!
    How about a testing this with Navigation Drawer: http://motzcod.es/post/60427389481/effective-navigation-in-xamarin-android-part-1
    It's should work, I guess.
    One thing: ActionBarCompat adding Xamarin.V4 lib, that conflicted with Mono..Android.Support.V4 which some MvvmCross components uses.

    ReplyDelete
  2. Android.Support.V4.Widget.DrawerLayout
    this component is in both assemblies

    ReplyDelete
  3. This saved me a lot of work. Lots of thanks for this post. Cheers!

    ReplyDelete