TabLayout - 找不到属性的资源标识符

时间:2015-12-23 05:50:37

标签: android material-design

我正在使用新的android小部件包TabLayout

中引入的android.support.design.widget.TabLayout

昨天我的代码工作正常,现在我今天开始使用我的计算机并尝试重新构建项目,现在Compiler先生正在说错误

Error:(22) No resource identifier found for attribute 'eleMode' in package 'android'
Error:(22) No resource identifier found for attribute 'tabGrvation' in package 'android.com.hsc.yatra'
Error:(22) No resource identifier found for attribute 'tabavity' in package 'android.com.hsc.yatra'

请指导我哪里不对?所以我的编译器开心,然后编译项目。

这是我的XML,其中发生了原始错误

<android.support.design.widget.CoordinatorLayout 

    xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.design.widget.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

            <!--<android.support.v7.widget.Toolbar-->
            <!--android:id="@+id/toolbar"-->
            <!--android:layout_width="match_parent"-->
            <!--android:layout_height="?attr/actionBarSize"-->
            <!--android:background="?attr/colorPrimary"-->
            <!--app:layout_scrollFlags="scroll|enterAlways"-->
            <!--app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />-->
            <include layout="@layout/toolbar_searched_bus">

            </include>

            <android.support.design.widget.TabLayout
                android:id="@+id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:eleMode="fixed"
                app:tabGrvation="2dp"
                app:tabavity="fill" />
        </android.support.design.widget.AppBarLayout>

        <android.support.v4.view.ViewPager
            android:id="@+id/viewpager"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior" />
    </android.support.design.widget.CoordinatorLayout>

2 个答案:

答案 0 :(得分:6)

将支持库添加到 build.gradle(Module:app),如下所示,

dependencies {
 compile 'com.android.support:design:24.+'
}

答案 1 :(得分:0)

xml属性中存在拼写错误。将属性更改为以下内容并尝试。

<android.support.design.widget.TabLayout
    android:id="@+id/tabs"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:elevation="2dp"
    app:tabMode="fixed"
    app:tabGravity="fill"/>
相关问题