material-icons 问题:Apache Royale 上没有图片图标

issue with material-icons : no picture icon on Apache Royale

我想像在 TourDeJewel 中一样使用图标图像,但是当我使用此代码时,显示的是文本 "MENU" 而不是图标图片。 (SDK 0.9.6)

    <j:IconButton >
        <j:icon>
            <js:FontIcon text="menu" material="true"/>
        </j:icon>
    </j:IconButton>

使用浏览器检查器工具检查后 material-icons css 丢失

有人能告诉我为什么吗? 提前谢谢你...

要自动获得 CSS linked 你需要至少使用一次 MaterialIconType class 这样编译器可以处理。

原因是 class 在其构造函数中有一个 inject_html 指令,因此当编译器发现它时会自动包含它。

Tour De Jewel 中,我们通过绑定使用 class:

<j:IconButton click="drawer.isOpen ? drawer.close() : drawer.open()">
    <j:icon>
        <js:FontIcon text="{MaterialIconType.MENU}" material="true"/>
    </j:icon>
</j:IconButton>

(请注意,在该文件中,我们在顶层使用绑定珠来进行绑定(即:<js:ContainerDataBinding/>)。

如果您不想使用 MaterialIconType,您可以 link 使用自定义 html 模板手动设置它。