2012-11-16 36 views
1

当实现一个轮播我有我的xml文件的问题。 main.xml中的布局显示了以下错误在这条线找到carousel android error:没有找到资源标识符的属性'UseReflection'包

多个注释:

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

主要布局是这样的:

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

在我的价值文件夹中的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> 

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

回答

10

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

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

应该

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

此外,您的属性名称必须以小写字母按约定的android启动。

+0

是的,它被很好的替换,但问题仍然存在 – PIONA

相关问题