Is it possible Set ActionBar Title to Bold in Android?

JKayJKay USMember ✭✭✭
edited September 2015 in Xamarin.Forms

I have got a NavigationRenderer like so:

[assembly: ExportRenderer(typeof(NavigationPage), typeof(MyApp.Droid.CustomRenderers.CustomNavigationPageRenderer))]  
namespace FieldStrikeMove.Droid.CustomRenderers
{
    public class CustomNavigationPageRenderer : NavigationRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<NavigationPage> e)
        {
            base.OnElementChanged(e);

            var actionBar = ((Activity)Context).ActionBar;
            //actionBar.TitleFormatted = ....
        }

    }
}

But how do I set the Title font to Bold. I can't work out how to use the TitleFormatted property?

Answers

  • ChaseFlorellChaseFlorell CAInsider, University mod
    edited September 2015

    I wish I had code to show you, but alas, I left it on my other laptop. You can update the text however you like, but you need to do it through the Android specific style.xml resource... or at least that's the cleanest place for it.

    It can also be done in code, but that requires locating the specific element and applying styles that way.

  • JKayJKay USMember ✭✭✭

    @ChaseFlorell Thanks again for a point in the right direction. I really really can't get to grips with the Android themes but it seems like the easiest way. I may try for a bit more before trying something else

    I guess the only other way is to use ActionBarSherlock to locate the element and change it in code

  • JKayJKay USMember ✭✭✭

    This blog post: motzcod.es/post/115523285992/material-design-theming-for-xamarinforms-android proved very useful. Thanks for the help

Sign In or Register to comment.