error: No resource identifier found for attribute ‘footerColor’ in package

异常提示:

使用自定义控件,引用包名应该是AndroidManifest.xml中所定义的包路径,并非src下.java文件所指向的包,这个容易犯错!

否者Android studio 中的xml布局界面,运行后会提示以下错误:

error: No resource identifier found for attribute ‘footerColor’ in package

一般情况下,加上这一句就可以了,特殊情况下,再根据上边那种实现

xmlns:app="http://schemas.android.com/apk/res-auto"

参考xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    android:id="@+id/container"
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.lvche.app"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res/com.lvche.app"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentBottom="true"
    android:background="@color/white_pure"
    >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="bottom"
        android:orientation="vertical"
        tools:ignore="UselessParent">

        <RelativeLayout
            android:id="@+id/topbanner"
            android:layout_width="match_parent"
            android:layout_height="@dimen/height_top_bar"
            android:background="@color/banner_bgcolor"
            android:gravity="center_vertical">

            <TextView
                android:id="@+id/topbanner_showtext"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:text="我的收藏"
                android:textColor="#ffffff"
                android:textSize="23sp"/>

            <Button
                android:id="@+id/topbanner_setting"
                android:layout_width="60dp"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_centerVertical="true"
                android:background="@color/orange"
                android:onClick="save"
                android:textColor="#fff"
                android:textSize="18sp"
                android:visibility="gone"/>
        </RelativeLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:orientation="vertical"
            tools:ignore="InefficientWeight">


            <com.lvche.app.incubator.ui.componennt.tabbarview.ui.TitleIndicator
                android:id="@+id/pagerindicator"
                android:layout_width="fill_parent"
                android:layout_height="50dp"
                android:background="#ffffff"
                app:footerColor1="@color/tab_indicator_text_selected"
                app:footerLineHeight1="0dp"
                app:footerTriangleHeight1="3.0dp"
                app:textColor="@color/tab_indicator_text"
                app:textSizeNormal="@dimen/common_text_size_middle_2"
                app:textSizeSelected="@dimen/common_text_size_middle_2"
              />

            <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="1.0dp"
                android:background="#eeeeee">
            </RelativeLayout>

            <!-- Don't set background for ViewPager. It doesn't work because of page margin -->

            <com.lvche.app.incubator.ui.componennt.tabbarview.ui.ViewPagerCompat
                android:id="@+id/pager"
                android:layout_width="fill_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:clickable="false"
                android:duplicateParentState="true"/>
        </LinearLayout>
    </LinearLayout>

</RelativeLayout>



猜你喜欢

转载自blog.csdn.net/wuqilianga/article/details/51131496