Xamarin.forms tabbed page

时间:2017-06-01 06:38:30

标签: xamarin.forms

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?)

1 个答案:

答案 0 :(得分:0)

这是我的TabbedPage布局。试试这个:

<?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" />

这是我的ToolBar布局:

<?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>