Search code examples
androidxamarinmvvmcrosshamburger-menu

Xamarin Android can't create AppBarLayout


I am using MvvmCross example of Sliding menu https://github.com/MvvmCross/MvvmCross-Samples/tree/master/XPlatformMenus

As the example shows, I created the same style files and added the same code. Now in my toolbar.axml I try to create AppBarLayout (the same as in the example). And visual studio shows me this error:

enter image description here

I can't understand why is it.... I tried, cleaning solution, deleting obj/bin folders, restarting visual studio and rebuilding solution.

This is the code to the appbarlayout:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:minWidth="25px"
    android:minHeight="25px"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:id="@+id/appBarLayout1"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        local:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.AppBarLayout>

and my style files looks the same as here: https://github.com/MvvmCross/MvvmCross-Samples/blob/master/XPlatformMenus/XPlatformMenus.Droid/Resources/values/styles.xml

https://github.com/MvvmCross/MvvmCross-Samples/blob/master/XPlatformMenus/XPlatformMenus.Droid/Resources/values-v21/styles.xml

Is it something with versioning?

I'm now targeting Android v7.1 (Nougat) API 25

Xamarin libraries are v25.4.0.2

MvvmCross libraries are v5.2.0

jdk v1.8.0_152

android-ndk-r13b

android SDK v25


Solution

  • Please make sure your theme in the designer is set to a theme which has a reference to a Theme.Appcompat theme

    enter image description here

    enter image description here

    Let me know if this helped