Nativescript using custom icons on NavigationButton

时光总嘲笑我的痴心妄想 提交于 2019-12-25 09:30:14

问题


I'm trying to add a button with custom fonts on the ActionBar on a NativeScript Angular app. This is what I tried so far:

<ActionBar class="cp-icon">
    <NavigationButton text="&#xE801;" (tap)="goBack()"></NavigationButton>
    <Image src="res://logo_h_white"></Image>
</ActionBar>

// Or one of these optio
<ActionItem text="&#xE801;" (tap)="goBack()"></ActionItem>
<Label text="&#xE801;"></Label>
<Button text="&#xE801;"></Button>

But none of them seems to be working. I do have the font instaled because I can use in the view. Also, if I just change the text attribute to be a string instead of an icon, it also doesn't show nothing.

Is there a way to do this?


回答1:


Your best bet is using the nativescript-ngx-fonticon plugin: https://github.com/NathanWalker/nativescript-ngx-fonticon

Avoid a few common pitfals by also checking this SO answer: https://stackoverflow.com/a/41861624/2596974



来源:https://stackoverflow.com/questions/44360804/nativescript-using-custom-icons-on-navigationbutton

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!