首页 > 解决方案 > 材料图标问题:Apache Royale 上没有图片图标

问题描述

我想使用 TourDeJewel 中的图标图像,但是当我使用此代码时,会显示文本“菜单”而不是图标图片。(SDK 0.9.6)

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

使用浏览器检查器工具检查后,material-icons缺少 css

有人能告诉我为什么吗?先感谢您...

标签: google-material-iconsapache-royale

解决方案


要自动链接CSS,您需要MaterialIconType至少使用一次 class,以便编译器可以处理它。

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

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

<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,可以使用自定义 html 模板手动链接。


推荐阅读