Forum Xamarin Xamarin.Forms

Xamarin.Forms: How to add logo to the navigation bar on Android?

I achieve to add a logo with a custom navigation renderer on iOS. However, I have some troubles with the Android version. Here are my custom renderer codes for Android:

using Xamarin.Forms.Platform.Android;
using Xamarin.Forms;

[assembly: ExportRenderer(typeof(NavigationPage), typeof(CustomNavigationPage))]
    public class CustomNavigationPage : NavigationRenderer
        protected override void OnElementChanged(ElementChangedEventArgs<NavigationPage> e)

            var actionBar = ((Activity)Context).ActionBar;

It gives these errors:


Warning CS0618: 'NavigationRenderer.NavigationRenderer()' is obsolete: 'This constructor is obsolete as of version 2.5. Please use NavigationRenderer(Context) instead.' (CS0618)


Error CS0246: The type or namespace name 'Activity' could not be found (are you missing a using directive or an assembly reference?) (CS0246)

I need to have this structure:

Best Answer


  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    I suggest you to upgrade to XF 3.2 and use TitleView

  • XF version is already set to 3.2.

    However, I cannot use <NavigationPage.TitleView> tag in this scenario:

    <?xml version="1.0" encoding="utf-8"?>
    <MasterDetailPage xmlns="" xmlns:x="" xmlns:local="" x:Class="">
            <ContentPage Title="Menu" BackgroundColor="#0a82b8" Icon="menu.png">
                <StackLayout Orientation="Vertical">
                    <ListView x:Name="navigationDrawerList" RowHeight="55" SeparatorVisibility="None" BackgroundColor="#ffffff" ItemSelected="OnMenuItemSelected">
                                    <!-- Main design for our menu items -->
                                    <StackLayout VerticalOptions="FillAndExpand" Orientation="Horizontal" Padding="20,10,0,10" Spacing="20">
                                        <Label Text="{Binding Title}" FontSize="Large" VerticalOptions="Start" HorizontalOptions="CenterAndExpand" TextColor="#28DDFF" FontAttributes="Bold" />
                <Label Text="My TitleView"/>

    The output of the debug:

    Type NavigationPage.TitleView not found in xmlns

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭
    Have you tried the sample i sent to you?
  • MadameGreenPeaMadameGreenPea Member ✭✭
    Accepted Answer

    Thank you for your suggestion.

    I added the logo by following this way:

Sign In or Register to comment.