Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Peedroca
Peedroca

Posted on

     

Material font icons on Xamarin Forms

Hello devs 🖖, recently I'm searching how to use Materialize icons in my mobile app maked with Xamarin.Forms 4.8, but I could't find a great step by step. Therefore I will try to do it today.

Font Source

You need to download the TFF font atmaterial design google repo, so go to material-design-icons > font > MaterialIcons-Regular.ttf.

Using font icon

Step 1. Put archievetff on folderFonts in your Xamarin Shared Project.

image

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

Step 2. AddExportFont in yourApp.xaml.cs as below:

...[assembly:ExportFont("MaterialIconsRegular.ttf",Alias="Material")]namespaceMaterialApp{publicpartialclassApp:Application{publicApp(){InitializeComponent();MainPage=newMainPage();}...
Enter fullscreen modeExit fullscreen mode

Alias is optional.

Step 3. Use a materialize font in any page you need.

<StackLayout><LabelText="&#xe87C;"FontSize="50"TextColor="Orange"FontFamily="Material"HorizontalOptions="Center"/></StackLayout>
Enter fullscreen modeExit fullscreen mode

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

I like to search icons onhttps://material.io/resources/icons/?style=baseline and get theirs names, so I find the hexadecimal code at MaterialIcons-Regular.codepoints. (you can find it in google repo.)

That's all, folks. 😄

Top comments(3)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
vhugogarcia profile image
Victor Hugo Garcia
Passionate software engineer with a love for design and an unwavering commitment to enjoying life to the fullest.
  • Location
    Austin, Texas
  • Education
    Instituto Tecnológico de Ciudad Guzman
  • Work
    Software Engineer at simplea.com
  • Joined

Very nice article. However, I could not find a way to use MaterialIcons rounded or outlined versions.

I'm wondering if you have implemented those versions.

Thanks in advance

CollapseExpand
 
peedroca profile image
Peedroca
Currently I'm working as C# Developer making extraordinaries mobile apps with Xamarin Forms.
  • Location
    Sao Paulo, brazil
  • Work
    Programmer at Hunes Tecnologia
  • Joined

Thanks!

The rounded and outlined icons was added some months ago... Try get it here:github.com/google/material-design-...

Tell me if you got it!

CollapseExpand
 
raselb_ profile image
Russell.
  • Joined

I followed the step by step instructions but my icon does not appear as intended. here's how it looks like.

Image description

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Currently I'm working as C# Developer making extraordinaries mobile apps with Xamarin Forms.
  • Location
    Sao Paulo, brazil
  • Work
    Programmer at Hunes Tecnologia
  • Joined

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp