carousel android error:在包中找不到属性'UseReflection'的资源标识符

PIO*_*ONA 1 xml android carousel android-layout

实现轮播时我的xml文件有问题.main.xml布局显示以下错误

在此行找到多个注释:

- error: No resource identifier found for attribute 'UseReflection' in package 
 ''
- error: No resource identifier found for attribute 'SelectedItem' in package 
 ''
- error: No resource identifier found for attribute 'Items' in package ''

- error: No resource identifier found for attribute 'Names' in package 
 ''
Run Code Online (Sandbox Code Playgroud)

主要布局如下:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:pj="http://schemas.android.com/apk/res/packagename"

    xmlns:bm="package name"

    android:layout_width="fill_parent"

    android:layout_height="fill_parent"

    android:orientation="vertical"
>

     <TextView

        android:layout_width="fill_parent"

        android:layout_height="fill_parent"

        android:layout_weight="0.5"

        android:text="text"

        android:id="@+id/selected_item"

        android:background="#1E1921"

        android:textColor="#A85E4F"

        android:textStyle="normal"

        />

   <package.controls.Carousel 

         android:id="@+id/carousel"

         android:layout_width="413dp"

         android:layout_height="446dp"

         android:layout_gravity="center_horizontal"

         pj:Items="@array/entries"

         pj:Names="@array/names"

         pj:SelectedItem="0"

         pj:UseReflection="true" >

     </package.controls.Carousel>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我的值文件夹中的attrs.xml

<resources>

        <declare-styleable name="Carousel">

        <attr name="android:gravity" /> 

        <attr name="android:animationDuration" />

        <attr name="UseReflection" format="boolean"/>

        <attr name="Items" format="integer"/>

        <attr name="SelectedItem" format="integer"/>

        <attr name="maxTheta" format="float"/>

        <attr name="minQuantity" format="integer"/>

        <attr name="maxQuantity" format="integer"/>

        <attr name="Names" format="string" />

    </declare-styleable>    

</resources>
Run Code Online (Sandbox Code Playgroud)

这是一个日食错误还是我错过了一步.可以帮忙吗?

Vin*_*rat 10

您是否正确地替换packagename了实际应用程序的包名称(如com.myapp)?

xmlns:pj="http://schemas.android.com/apk/res/packagename"
Run Code Online (Sandbox Code Playgroud)

应该

xmlns:pj="http://schemas.android.com/apk/res/com.myapp"
Run Code Online (Sandbox Code Playgroud)

此外,根据android约定,您的属性名称应以小写字母开头.