2
votes

when I use a Custom Renderer for TabbedPages in Xamarin Forms, the TabLayout is completely removed, and thus only the first Tab is accessible. This is even the case with an "empty" Custom Renderer like this:

public class MyTabbedRenderer: TabbedRenderer
    {
        public MyTabbedRenderer(Context c) : base(c) { }
        public MyTabbedRenderer() : base() { }
    }

When I do not use a Custom Renderer for the TabbedPage, the Tablayout renders fine.

Is this a Bug or am I forgetting some code? I am just using a Custom Renderer on Android.

Edit: Xaml of the Page

<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            x:Class="App.Client.View.MyTabbedPage">
    <TabbedPage.ToolbarItems>
        <ToolbarItem/>
    </TabbedPage.ToolbarItems>
    <ContentPage>
        <ContentPage.Content>
            <view:MyView1/>
        </ContentPage.Content>
    </ContentPage>
    <ContentPage>
        <ContentPage.Content>
            <view:MyView2/>
        </ContentPage.Content>
    </ContentPage>
</TabbedPage>
1
Let me have a look on your xaml please? - FreakyAli
remove the line "public MyTabbedRenderer() : base() { }" and let us know - Nick Kovalsky
@NickKovalsky sadly does not help - Canonip
@G.hakim Added in original post - Canonip

1 Answers

4
votes

The TabbedRenderer which I inherited from is a Xamarin.Forms.Platform.Android.TabbedRenderer

This renderer uses the old ActionBar layout, which deprecated in Android 5.0 Lollipop.

Inheriting from the Xamarin.Forms.Platform.Android.AppCompat.TabbedPageRenderer, which utilizes the AppCompat's Toolbar and Tabbar solves the problem.