如何在应用程序的 AndroidManifest.xml 中引用库项目中的图标
我试图对从图书馆项目派生的所有应用程序使用相同的应用程序图标。
我认为这就像实施提供的建议一样简单 在此线程中,但不幸的是它不起作用。
我所做的是将以下行添加到应用程序的 AndroidManifest.xml
中的
标记中:
xmlns:mylib="http://schemas.android.com/apk/res/com.example.baseapp"
在同一 AndroidManifest.xml< /code> 文件,将典型的
@drawable/icon
更改为:
<application android:icon="@mylib:drawable/icon">
但它不起作用!
相反,Eclipse 告诉我:
错误:错误:找不到资源 与给定名称匹配(在“图标”处) 值“@omlib:drawable/icon”)。
显然,从布局 XML 和清单 XML 引用可绘制对象是不同的。
如何在应用程序的 AndroidManifest.xml 中引用库项目中的图标?
I am trying to use the same application icon for all applications derived from a Library Project.
I thought that it would be as simple as implementing the advice provided in this thread, but unfortunately it doesn't work.
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"
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!
Instead, Eclipse tells me that:
error: Error: No resource found that
matches the given name (at 'icon' with
value '@omlib:drawable/icon').
Apparently, referencing drawables from a layout XML and the manifest XML are not the same.
How do I reference an icon from a Library Project in Application's AndroidManifest.xml?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试仅使用可绘制/图标?我不知道你的设置,但它对我有用。
也许在一个好的项目和库清理之后......
Did you try with drawable/icon only ? I don't know about your setup but it works for me.
Perhaps after a good project and librairy clean up...
对于仍在阅读本文的人:
我相信这个问题从 SDK17 开始就被修复了。
您应该编写以下内容:
这应该使您也能够引用图书馆项目中的资源。
For people still reading this:
I believe this was fixed since SDK17.
you should write the following:
This should enable you to reference resources from library projects as well.