Reputation: 61
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>
Upvotes: 2
Views: 631
Reputation: 61
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.
Upvotes: 4