Nativescript using custom icons on NavigationButto

2019-09-20 07:36发布

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条回答
女痞
2楼-- · 2019-09-20 07:58

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

查看更多
登录 后发表回答