Xamarin android native.

All my images have the following properties: AndroidResource , Не копировать . Actually, Icon.png already included in the project has the same settings.

Trying to write markup:

  <ImageView android:id="@+id/Label_iv" android:layout_gravity="center" android:src="@drawable/labels/label" /> 

Begins to swear: No resource found that matches the given name . I looked through resources in the project Icon.png , using the example of Icon.png , I found it only in Resource.Designer.cs

  public partial class Drawable { // aapt resource value: 0x7f020000 public const int Icon = 2130837504; ... 
  • one
    I do not know how to xamarin, and in the native android, the Drawable folder cannot include arbitrary subfolders (without additional settings for the project's backup script). All images are only in the root folder - pavlofff

1 answer 1

Everything turned out to be easier:

The properties of the files were correct. What I dug in the direction of Resource.Designer.cs is also true. But as it turned out, xamarin itself generates this class, and, moreover, it generates it without nested folders, that is.

The structure of my drawable folder was:

 drawable |_itemIcons |_labels | |_label.png |_icon.png 

Everything that is inside the itemIcons and labels subfolders, he doesn’t see ... The solution is simple: move all resources to the drawable folder and do not produce subfolders.