Xamarinフォームの材料フォントのアイコン


こんにちは、DEVS🖖, 最近私はMaxializeアイコンを使用する方法を探している私の携帯アプリのxamarinをマージ.フォーム4.8、しかし、私は一歩一歩偉大なを見つけることができませんでした.したがって、私は今日それをしようとします.

フォントソース


TFFフォントをダウンロードする必要がありますmaterial design google repo , だから、材料のデザインのアイコンを移動します.TTF

フォントアイコンの使用


ステップ1.安置するtff フォルダにFonts あなたのXamarin共有プロジェクトで.

Don't forget to set build action as Embedded resource.


手順2.追加ExportFont あなたのApp.xaml.cs 下記のようになります.
...

[assembly: ExportFont("MaterialIconsRegular.ttf", Alias = "Material")]
namespace MaterialApp
{
    public partial class App : Application
    {
        public App()
        {
            InitializeComponent();

            MainPage = new MainPage();
        }

...

Alias is optional.


ステップ3.必要に応じて任意のページのフォントを実現します.
<StackLayout>
    <Label Text="&#xe87C;" FontSize="50" TextColor="Orange"
           FontFamily="Material" HorizontalOptions="Center" />      
</StackLayout>

You will need the hexadecimal code, You can get it at MaterialIcons-Regular.codepoints.


私はアイコンを検索するhttps://material.io/resources/icons/?style=baseline そして、自分の名前を取得するので、MaterialIconで16進数コードを定期的に見つける.コードポイント.( Google Repoで見つけられます)
それはすべて、人々です.😄