Forum Xamarin Xamarin.Android

Problem with resources folder in Xamarin.Android

Lost_OliveLost_Olive Member ✭✭

I've got this piece of code in my MainActivity.cs of my Xamarin.Android project.
ToolbarResource = Resource.Layout.Toolbar;
Somehow I get the error: Resource.Layout doesn't contain a definition for Toolbar. I don't understand why, because I've got the Toolbar.xml file in my layout folder. Can anyone help with this?

Best Answer

  • Lost_OliveLost_Olive Member ✭✭
    Accepted Answer

    Well, I just copied the lines which are in the 'Toolbar.xml' file of another project and somehow that worked.

    Nevertheless, I want to thank everyone for their help!

Answers

  • jezhjezh Member, Xamarin Team Xamurai

    You can try to delete the bin folders and the obj folders and rebuild it . If it doesn’t work ,try to restart the VS .

    If the problem still perisists,could you please post a basic demo so that we can test on our side?

  • Lost_OliveLost_Olive Member ✭✭

    No, that didn't work.

    What files should I post?

  • Lost_OliveLost_Olive Member ✭✭
    Accepted Answer

    Well, I just copied the lines which are in the 'Toolbar.xml' file of another project and somehow that worked.

    Nevertheless, I want to thank everyone for their help!

Sign In or Register to comment.