【问题标题】:Error: String types not allowed (at 'src' with value 'splash/splash1.jpg'错误:不允许使用字符串类型(在 'src' 处,值为 'splash/splash1.jpg'
【发布时间】:2017-06-28 06:28:00
【问题描述】:

我正在使用 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 常量名称中的斜杠有错误,导致编译时出现多个错误。

当我的文件位于drawable文件夹的子目录中时,我应该如何在drawables中引用我的文件?

谢谢。

【问题讨论】:

  • 你能把我的答案标记为正确吗?

标签: android xamarin imageview


【解决方案1】:

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

获取更多信息here

【讨论】:

  • 这就确定了。杰费里诺。我在 Internet 上的某个地方读到,您可以在 drawables 子文件夹中组织您的资源,一定是您无法相信您在 Internet 上阅读的所有内容之一。无论如何感谢您的回答。欣赏它。
猜你喜欢
  • 1970-01-01
  • 2017-04-03
  • 1970-01-01
  • 2016-05-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多