Skip to content

Instantly share code, notes, and snippets.

@malexandersalazar
Last active June 15, 2016 05:50
[Xamarin] ¿Cómo usar Segoe MDL2 Assets en Xamarin.Android? - http://epicalsoft.blogspot.pe/2016/06/xamarin-como-usar-segoe-mdl2-assets-en.html . #Xamarin #VisualStudioAndDevelopmentTechnologies Autor: M. Alexander Salazar​ (http://bit.ly/1urSn7l)
using Android.Content;
using Android.Runtime;
using Android.Util;
using Android.Widget;
using System;
namespace Blog.Epicalsoft.Com.Droid.Views
{
public class IconTextView : TextView
{
public IconTextView(Context context) : base(context)
{
Typeface = SegoeMDL2Typeface.Instance;
Gravity = Android.Views.GravityFlags.CenterVertical;
}
public IconTextView(Context context, IAttributeSet attrs) : base(context, attrs)
{
Typeface = SegoeMDL2Typeface.Instance;
Gravity = Android.Views.GravityFlags.CenterVertical;
}
public IconTextView(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle)
{
Typeface = SegoeMDL2Typeface.Instance;
Gravity = Android.Views.GravityFlags.CenterVertical;
}
protected IconTextView(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
{
Typeface = SegoeMDL2Typeface.Instance;
Gravity = Android.Views.GravityFlags.CenterVertical;
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<blog.epicalsoft.com.droid.views.IconTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="\uE001 " />
</LinearLayout>
using Android.App;
using Android.Graphics;
namespace Blog.Epicalsoft.Com.Droid
{
public class SegoeMDL2Typeface
{
public static Typeface Instance = Typeface.CreateFromAsset(Application.Context.Assets, "segmdl2.ttf");
private SegoeMDL2Typeface()
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment