如何从图书馆工程应用的Andr​​oidManifest.xml中引用的图标 [英] How to reference an icon from a Library Project in Application's AndroidManifest.xml

查看:187
本文介绍了如何从图书馆工程应用的Andr​​oidManifest.xml中引用的图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用从库项目派生的所有应用程序相同的应用程序图标。

I am trying to use the same application icon for all applications derived from a Library Project.

我想,这将是作为实现所提供的意见<一个简单href=\"http://stackoverflow.com/questions/6241429/how-to-reference-a-drawable-from-a-library-project-into-a-main-projects-layout-i/6241484#6241484\">in这个线程,但遗憾的是它不工作。

I thought that it would be as simple as implementing the advice provided in this thread, but unfortunately it doesn't work.

我所做的是添加到&LT;清单&GT; 标签在应用程序的的Andr​​oidManifest.xml 以下行

What I did is add to the <manifest> tag in the application's AndroidManifest.xml the following line:

xmlns:mylib="http://schemas.android.com/apk/res/com.example.baseapp"

和几行上下一致的Andr​​oidManifest.xml 文件,更改典型 @绘制/图标来:

And a few lines down the same AndroidManifest.xml file, change the typical @drawable/icon to:

   <application android:icon="@mylib:drawable/icon">

不过,这是行不通的!

But it doesn't work!

相反,Eclipse的告诉我说:

Instead, Eclipse tells me that:

错误:错误:没有资源的发现,
  匹配给定的名称(在图标与
  值@omlib:绘制/图标。)

error: Error: No resource found that matches the given name (at 'icon' with value '@omlib:drawable/icon').

显然,从布局XML和清单的XML引用可绘是不一样的。

Apparently, referencing drawables from a layout XML and the manifest XML are not the same.

如何在应用程序的Andr​​oidManifest.xml中引用的图标从图书馆计划?

How do I reference an icon from a Library Project in Application's AndroidManifest.xml?

推荐答案

您是否尝试过只绘制/图标?我不知道你的设置,但它为我工作。

Did you try with drawable/icon only ? I don't know about your setup but it works for me.

后,也许一个好的项目和librairy清理...

Perhaps after a good project and librairy clean up...

这篇关于如何从图书馆工程应用的Andr​​oidManifest.xml中引用的图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆