Jsmnt
Jsmnt

Reputation: 21

Use Theme.AppCompat in a xamarin.android app

I'm trying to make an Android app through Xamarin. I work on Windows 10 with VS2015.

I have to implement a side bar menu. After some research I found a solution to do it : use a DrawerLayout and others tools. That's why I use Theme.AppCompat in my application.

But when I'm trying to make a style which herits from Theme.Appcompat.light.NoActionBar, I got compile issue. The message is :

Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.AppCompat.Light.NoActionBar'.

I've added Xamarin.Android.Support.v4 and Xamarin.Android.Support.v7.AppCompat references to my project as bellow :

Project References

Edit: I also tried to add them by xamarin Component and nuget package manager.

But nothing compile.

Here is the code which produce this error:

<resources>
  <style name="DailyCoin.HomeTheme" parent="@android:style/Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">#219653</item>
    <item name="drawerArrowStyle">@style/MyDrawerArrowStyle</item>
  </style>
  <style name="MyDrawerArrowStyle" parent="@android:style/Widget.AppCompat.DrawerArrowToggle">
    <item name="color">#F5F5F5</item>
    <item name="spinBars">true</item>
  </style>
</resources>

minSdkVersion is 17 and compile using version is 23

Upvotes: 0

Views: 1695

Answers (3)

Jsmnt
Jsmnt

Reputation: 21

Ok, I found the solution. My problem was that xamarin was corrupted and the component adding module had some troubles when i added components. So i removed all references/components i've added to my projet, reinstalled xamarin.

Just for people impatient like me: Then i had a new issue : "Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r28.zip" because when generated the solution, it took a lot of time and i stoped this. The solution was to delete all zips in "%localappdata%/xamarin/zips" and wait for the generation.

Thank for your help !

Julien

Upvotes: 2

jimmgarr
jimmgarr

Reputation: 1483

Leave out @android:style/ so just:

parent="Theme.AppCompat.Light.NoActionBar"

Upvotes: 0

Henrique Forlani
Henrique Forlani

Reputation: 1353

Did you try this? parent="Theme.AppCompat.Light.NoActionBar"

Check this out (its working for me): Navigation Drawer using material design

Upvotes: 0

Related Questions