priya_d
priya_d

Reputation: 403

Xamarin.forms tabbed page

When i am trying to use toolbar getting following error at runtime. Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class android.support.design.widget.Toolbar

Also I am not able to access toolbar of Android.Support.V7.Widget it gives me error CS0234 C# The type or namespace name does not exist in the namespace (are you missing an assembly reference?)

Upvotes: 0

Views: 199

Answers (1)

Naveen Gogineni
Naveen Gogineni

Reputation: 306

This is my TabbedPage Layout. Try using this:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.TabLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/sliding_tabs"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#EDEDED"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:tabTextColor="#000000"
    app:tabSelectedTextColor="#d99a33"
    app:tabIndicatorColor="#d99a33"
    app:tabGravity="fill"
    app:tabMode="scrollable" />

And this is my ToolBar Layout:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?attr/colorPrimary"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    android:popupTheme="@style/ThemeOverlay.AppCompat.Light">

<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:id="@+id/toolbar_title" />

</android.support.v7.widget.Toolbar>

Upvotes: 0

Related Questions