0

I'm brand new both to Xamarin and the Rider IDE, but not to Android. I'm going through some test projects, but when I make a new project, the ProjectName/Resources folder is missing things that I would expect to be there, most notably drawable. How can I create or get access to those directories so that I can do something like set the app icon?

I've tried creating a drawable directory, including it, and making sure that the build action is set to AndroidResource, but when I add Icon = @drawable/icon.png in the MainActivity, it doesn't recognize the drawable tag.

Cameron
  • 1,281
  • 1
  • 19
  • 40

2 Answers2

0

I found a solution for this. As I mentioned, I created the drawable folder manually, added the icon to it and made sure to right click and Include it. Then, in the manifest, I added android:icon="@drawable/icon and that got the icon to show up properly. So it didn't fix the issue of the folders not being generated, but at least for a simple task like updating the icon, it worked.

Cameron
  • 1,281
  • 1
  • 19
  • 40
0

You can also declare in xaml.cs file, in your xaml form constructor the following:

x:Name_of_your_image/icon.ImageSource = (FileImageSource) ImageSource.FromFile("image/icon_name");

This way you won't need the drawable folders, as it will automatically provide the source of the image.

Simas Joneliunas
  • 2,890
  • 20
  • 28
  • 35
helenz
  • 1
  • 1