Skip to content

Instantly share code, notes, and snippets.

@dshookowsky
Last active August 29, 2015 14:13
Show Gist options
  • Save dshookowsky/3679a6bdc83fc4f9f285 to your computer and use it in GitHub Desktop.
Save dshookowsky/3679a6bdc83fc4f9f285 to your computer and use it in GitHub Desktop.
Using font icons in Xamarin.Android
public override View GetView (int position, View convertView, ViewGroup parent)
{
var item = items [position];
View view = convertView;
TextView details = null;
if (view == null) { // no view to re-use, create new
view = context.LayoutInflater.Inflate (Resource.Layout.Room, null);
Typeface tf = Typeface.CreateFromAsset(Application.Context.Assets, "icomoon.ttf");
view.FindViewById<TextView>(Resource.Id.status).SetTypeface(tf, TypefaceStyle.Normal);
details = view.FindViewById<TextView>(Resource.Id.details);
details.SetTypeface(tf, TypefaceStyle.Normal);
details.Text = '\xe953'.ToString();
}
TextView statusTextView = view.FindViewById<TextView>(Resource.Id.status);
statusTextView.SetTextColor(_freeBusyColor[item.free]);
statusTextView.Text = _freeBusyChar[item.free].ToString();
view.FindViewById<TextView>(Resource.Id.roomName).Text = item.roomName;
details = view.FindViewById<TextView>(Resource.Id.details);
details.SetOnTouchListener(this);
details.Tag = item.emailAddress;
return view;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment