简体   繁体   English

我可以将SVG图像用作按钮图标吗?

[英]Can I use an SVG image as an button icon?

Is this possible at all? 这有可能吗? I call Image.createSVG(...) and receive an Image object without any errors. 我调用Image.createSVG(...)并收到一个没有任何错误的Image对象。 I then call Button.setIcon() . 然后,我调用Button.setIcon() But there's no icon on the button. 但是按钮上没有图标。

You need to check Image.isSVGSupported() which currently will always return false. 您需要检查Image.isSVGSupported() ,该当前将始终返回false。

Back in the day J2ME supported SVG thru one of the JSR's. 过去,J2ME通过一种JSR支持SVG。 No platform since has supported SVG natively with the exception of the web so this doesn't work on any of the modern platforms and we didn't bother implementing this even for the JavaScript port. 此后,除了Web之外,没有平台本地支持SVG,因此这在任何现代平台上均不起作用,即使对于JavaScript端口,我们也无需费心实现此功能。

In the future we'd like to have a more efficient/portable way of supporting SVG eg: https://github.com/codenameone/CodenameOne/issues/1890 将来,我们希望有一种更有效/便携式的方式来支持SVG,例如: https : //github.com/codenameone/CodenameOne/issues/1890

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

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