CallygraphyXamarin not working in MvxAppCompatActivity


I've have been trying for hours to get the custom fonts working in my MvvmCross project, specifically the Android platform.
I successfully installed the component and followed the steps mentioned:
It just doesn't want to work.

I tested it on a activity than inherits from "Activity" and "AppCompatActivity" they both work correctly.
Seems like inheriting from "MvxAppCompatActivity" breaks it? Any solutions this this problem?

Best Answer


  • cfl777cfl777 ZAMember ✭✭

    Thank you for your response!
    Wow that is complicated, will need to consider if this is worth it.

    Any other easier ways to use custom font in this situation that you know about?


  • trinnguyentrinnguyen VNMember ✭✭
    edited February 2017

    Yup, another way is applying Typeface manually by visiting all View element and its child views (if ViewGroup), then set the Typeface for each element.

    Should be called in Activity -> OnCreate after View is load:

    protected override void OnCreate(Bundle savedInstanceState)
        View view = this.Window.DecorView.FindViewById<View> (Android.Resource.Id.Content);
        ConfigFont (this, view);

    Draft the implementation

    public static void ConfigFont(Context ctx, View view)
        // This is for TextView, Button, EditText
        if (view is TextView)
            ((TextView)view).Typeface = LoadTypefaceFromAssets();
            // Typeface (font) is loaded from Assets folder, that can be different files, for Bold, Italic, Regular,... should read the original Typeface of element first to select the right Typeface
        // Here check other types, whatever Elements that supports Typeface
        // if ViewGroup, continue another session
        if (view is ViewGroup)
            for (int i = 0; i < ((ViewGroup)view).ChildCount; i++)
                View childView = ((ViewGroup)view).GetChildAt (i);
                ConfigFont(ctx, childView);
  • cfl777cfl777 ZAMember ✭✭

    Thank you for posting the secondary approach!

    Though it will work and be easier initially, it seems like it will create massive overhead for large projects.

    Appreciate your assistance.

Sign In or Register to comment.