【问题标题】:Import directory of images to the drawable resources in Android Studio将图片目录导入Android Studio中的drawable资源
【发布时间】:2014-01-22 22:49:50
【问题描述】:

我想导入一些图标,它们位于不同的目录中。我知道Android Studio允许将*.png文件直接导入项目的drawable-*目录,但是是否可以导入带有图片的目录并通过@drawable/访问它们?

【问题讨论】:

  • 你不能只使用标准的复制/粘贴吗?

标签: android import intellij-idea android-studio drawable


【解决方案1】:

你不能在drawable中使用子文件夹:

Can the Android drawable directory contain subdirectories?

出于某种原因,您是否必须使用“R”访问文件?如果没有,这可能会有所帮助:

Is it possible to load a drawable from the assets folder?

【讨论】:

    【解决方案2】:

    是的,您可以使用@Drawable/icon.pgn(带有扩展名的图片名称)。您也可以使用任何图片format。在此之前您必须导入图片correct methods。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多