I was facing the same problem and here is how I solved.
In the manifest you should add:
<application android:label="yourApp" android:theme="@style/AppBaseTheme"></application>
Your base activity should extend
: AppCompatActivity
and you must remove
this part
// Make this activity fullscreen
this.Window.AddFlags(WindowManagerFlags.Fullscreen);
Also from all your activities remove
Theme = "@style/AppTheme"
(so that they will be like this)
[Activity(Label = "Add Child")]
Now, your styles.xaml should be:
<resources>
<style name="AppBaseTheme" parent="AppBaseTheme.Base">
</style>
<!-- Base theme applied no matter what API -->
<style name="AppBaseTheme.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>
<!-- 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">#40FF81</item>
<!-- You can also set colorControlNormal, colorControlActivated
colorControlHighlight and colorSwitchThumbNormal. -->
</style>
</resources>
But you also need (it's required or Appcompat will not work) to create a new folder under Resources called values-v21 that will be seen only from device with Android 5+ and inside you will have another styles.xaml with this content:
<resources>
<style name="AppTheme" parent="AppTheme.Base">
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
<item name="android:windowSharedElementExitTransition">@android:transition/move</item>
</style>
</resources>
Note that the style name and the parent needs to be exactly the same of the other style file and yet the same declared in the manifest.
Now you need to directly reference the new Toolbar widget from the Support Library. If you haven’t already create a new Android Layout file under Resources/Layout/toolbar.axml do it. The file will look like this:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
With the Toolbar setup we you now integrate it into your layouts by using the include node to place the Toolbar.
I know, there was no need to include the action bar inside each layout before, but there's nothing to do about it: App Compat requires you include the toolbar in the activity layout.
this is an example:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar" />
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/main_content"
android:layout_below="@id/toolbar">
</LinearLayout>
</RelativeLayout>
The important part you shouldn't change (or do it accordingly with your id and layout toolbar.xaml) is this one:
<include android:id="@+id/toolbar" layout="@layout/toolbar" />
We are almost done:
to all your activities add:
using Toolbar = Android.Support.V7.Widget.Toolbar;
and your OnCreate method should start like this
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.main);
var toolbar = FindViewById<Toolbar> (Resource.Id.toolbar);
//Toolbar will now take on default actionbar characteristics
SetSupportActionBar (toolbar);
SupportActionBar.Title = "Hello from stackoverflow";
//..
}
Only after setting the ContentView you can set the toolbar.
These steps are working for me and helped me to update to AppCompatv7 r22.2
As far as I know AppCompatv7 r22.1 has some little bugs.
From Sept. 29 there is also a new version of AppCompat v7 (r.23)