【问题标题】:issue with material-icons : no picture icon on Apache Royale材料图标问题:Apache Royale 上没有图片图标
【发布时间】:2019-10-08 21:30:59
【问题描述】:
我想使用 TourDeJewel 中的图标图像,但是当我使用此代码时,会显示文本“菜单”而不是图标图片。 (sdk 0.9.6)
<j:IconButton >
<j:icon>
<js:FontIcon text="menu" material="true"/>
</j:icon>
</j:IconButton>
使用浏览器检查器工具检查后,material-icons css 丢失
谁能告诉我为什么?
提前谢谢你...
【问题讨论】:
标签:
google-material-icons
apache-royale
【解决方案1】:
要自动链接 CSS,您需要至少使用一次 MaterialIconType 类,以便编译器可以处理它。
原因是类在其构造函数中有一个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 模板手动链接。