我正在使用Xamarin在Android上开发启动画面。我有一个名为“ splash1.jpg”的图片放置在我的各个可绘制子文件夹中,其中包含子文件夹“ splash”。因此,例如,我有一个“ resources / drawable-hdpi / splash / splash1.jpg”和一个“ resources / drawable-mdpi / splash / splash1.jpg”。

在main.axml的布局中,有一行用于imageview源


  android:src =“ @ drawable / splash / splash1”


在我的resources.cs文件中自动生成以下行


  public const int splash / splash1 = 2130837505;


splash / slash1常量名称中的斜杠存在错误,导致编译时出现多个错误。

当文件位于可绘制文件夹的子目录中时,如何在可绘制对象中引用我的文件?

谢谢。

最佳答案

Android不支持/drawable文件夹中的子文件夹。
请删除您的/splash文件夹,并将splash图像直接放在/drawable文件夹中。

获取更多信息here

10-08 06:20