简体   繁体   English

firefox android bootstrapped扩展程序中的图标

[英]icons in a firefox android bootstrapped extension

I'm working on a bootstrapped extension for firefox android, and I have a problem with displaying icons in a new menu item: 我正在为firefox android开发自举扩展程序,但是在新菜单项中显示图标时遇到问题:

    itemMenuId = window.NativeWindow.menu.add("Show more details",ico , function() {   showToast(window); });

in ico I wrote the uri of the icon file existing in the root of my extension (icon.png is next to bootstrap.js), using data: and file://, like described here but the icon isn't displayed. 在ico中,我使用data:和file://编写了扩展名(icon.png在bootstrap.js旁边)中存在的图标文件的uri,如此处所述但未显示该图标。 I don't know how to fix the path for that. 我不知道该如何解决。 Beside I'm having the same problem with the iconURL in the install.rdf file, when I use chrome:// I get nothing, and when I use resource:// I get a missing image. 另外,在install.rdf文件中,使用iconURL遇到同样的问题,当我使用chrome://时,我什么也没得到,当我使用resource://时,我得到了一个丢失的图像。 Should I have chrome.manifest to use chrome://? 我应该有chrome.manifest使用chrome://吗? and even if I don't specify the url,to let the image be displayed by default like here it still doesn't work. 即使我未指定网址,也要默认显示图片(如此处所示) ,仍然无法使用。

    <em:iconURL>resource://trackdetect/icon.png</em:iconURL>

I googled it ,but, I couldn't fix it. 我用谷歌搜索,但无法修复。 Please help and thanks. 请帮忙,谢谢。

Erik Vold's guide explains how to reference files packaged within a bootstrapped extension. Erik Vold的指南介绍了如何引用自举扩展中打包的文件。

However it is strange that the icon doesn't appear at the addons list (you don't specify a iconURL, just place icon.png next to bootstrap.js, as you did). 但是,奇怪的是,该图标没有出现在插件列表中(您没有指定iconURL,就像您一样,只需将icon.png放在bootstrap.js旁边)。 Perhaps you should check if the tool you use creates PNGs that conform to the standard. 也许您应该检查所使用的工具是否创建了符合标准的PNG。

For the issue, just make sure you have a file named icon.png in the root of the XPI (the same folder as bootstrap.js) and the image will be used. 对于此问题,只需确保在XPI的根目录(与bootstrap.js相同的文件夹)中有一个名为icon.png的文件,并且将使用该图像。 You don't even need the entry in the manifest. 您甚至不需要清单中的条目。 See: https://developer.mozilla.org/en-US/docs/Install_Manifests#iconURL 请参阅: https : //developer.mozilla.org/zh-CN/docs/Install_Manifests#iconURL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM