Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Droid Sans Mono missing on Android?

$
0
0

I've updated to the latest Xamarin.Forms release, and figured I'd try out the new features. I wrote a simple class that inherits from ContentPage, and has a constructor like this, which takes in an object:

        var stack = new StackLayout (); 
        StringBuilder sb = new StringBuilder ();

        sb.Append ("PropertyName1:".PadRight(15) + " " + obj.Prop1 + Environment.NewLine);
            .
            .
            .
        sb.Append ("PropertyNameN:".PadRight(15) + " " + obj.PropN + Environment.NewLine);

        stack.Children.Add
        (
            new Label() 
            { 
                Text = sb.ToString (), 
                FontSize = Device.GetNamedSize (NamedSize.Medium, typeof(Label)),
                FontFamily = Device.OnPlatform (
                    iOS:      "Menlo-Regular", 
                    Android:  "Droid Sans Mono", 
                    WinPhone: "Segoe WP"),
                LineBreakMode = LineBreakMode.WordWrap
            }
        );
        stack.Spacing = 2;
        stack.Padding = new Thickness (4);

        Content = new ScrollView { VerticalOptions = LayoutOptions.Fill, Content = stack };

I've only tested it on Android, and the font never changes to Droid Sans Mono. It's still regular Droid Sans. Even when I change the FontFamily to be just "Droid Sans Mono", and test on Android, I still get regular Droid Sans. I can't seem to get Droid Sans Mono to ever show up, and I really need it for some views. I'm about to just add a custom monospace font and use it across all of my platforms, but it really seems like this should be easier. Can anyone help me resolve this issue?


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>