在 xamarin 形式中,使用图标作为 png 文件对于您需要做和验证的所有大小和 native 内容都非常痛苦。我决定使用很棒的字体,但这样我就不能放入工具栏项,也不能放入某些按钮中,也不需要文本。 有没有人有作为文件图像源使用的指南因为 fontimagesource 不兼容用于代替 fileimagesource。或者,任何人都可以使用一些我可以在我所有东西中使用的代码来制作pressEffect 的指南吗?
这不可能
<ContentPage.ToolbarItems>
<ToolbarItem>
<ToolbarItem.Icon>
<FontImageSource/>
</ToolbarItem.Icon>
</ToolbarItem>
</ContentPage.ToolbarItems>
这是它的工作方式
<ContentPage.ToolbarItems>
<ToolbarItem>
<ToolbarItem.Icon>
<FileImageSource/>
</ToolbarItem.Icon>
</ToolbarItem>
</ContentPage.ToolbarItems>
另一种方法是放入标签并与布局一起使用,但它们都没有打印效果
我希望在没有插件的情况下使用打印效果,可能使用简单的渲染,或者至少我想在工具项中使用 fonticon 像普通图像或文本一样。
Obs:工具栏项的文本没有字体族,如果有办法用转换器来做到这一点,我将不胜感激。
最佳答案
现在有了 Xamarin 4.0 新版本,这是可能的。以下代码工作正常:
<Button Text="Pesquisar">
<Button.ImageSource>
<FontImageSource Glyph="" FontFamily="{StaticResource FontIcon}"/>
</Button.ImageSource>
</Button>
这也是:
<ContentPage.ToolbarItems>
<ToolbarItem>
<ToolbarItem.IconImageSource>
<FontImageSource Glyph="" FontFamily="{StaticResource FontIcon}"/>
</ToolbarItem.IconImageSource>
</ToolbarItem>
</ContentPage.ToolbarItems>
关于c# - 在 xamarin.forms 中使用 fontawesome(仅限 iOS 和 Android),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55494006/