Forum Xamarin.Forms

Resources.Layout folder not shown in a Crossplatform Xamarin.Forms project.

Hello everyone!
I am currently working with Xamarin.Forms and I am trying to create a custom PageRenderer for Android which would display a stream from the camera. In every example I have met, the custom view was created thanks to a layout axml file located in Resources\layout that was called thanks to the command view = activity.LayoutInflater.Inflate (Resource.Layout.CameraLayout, this, false); such as in this example, which I am trying to replicate.
The problem is that Visual Studio does not display the subfolder layout inside Resources (the only subfolder shown is drawable). I tried navigating there and creating manually CameraLayout.axml but my program still refused to build when I called view = activity.LayoutInflater.Inflate (Resource.Layout.CameraLayout, this, false); explaining that "Resources.Layout contains no definition for CameraLayout". The strange thing is that when I work on another application developed with Xamarin (not Xamarin.Forms), that folder is shown and I face no problem when building the application.
Has anyone faced that problem before? If yes, how did you create your custom Android view?

I am quite new to Xamarin and Xamarin.Forms so there might be something obvious I have missed. I am working with Visual Studio 2015 on Windows 7.
Thank you kindly to anyone who will take the time to answer.

Maxime Larcher

Best Answer

Answers

  • HunumanHunuman GBMember ✭✭✭✭

    @MaximeLarcher

    With Xamarin.Forms I've always had to manually add the resource/sub-folders/items, into the android project, by right clicking the project->Add->Existing Item.

    Apologies if not applicable.

    Tim

  • BrandonBestBrandonBest USMember ✭✭

    Hello I know this is an old thread but I am having the same issue. Going into the project files using File Explorer I can see that there is no subfolder layout in the Resources folder at all with Xamarin.Forms. However Resources.Layout still comes up with options. Can I just manually add a layout folder or should I try and locate where this so called Resources.Layout is located?

Sign In or Register to comment.