2012-06-07 74 views
3

我正在嘗試使用https://github.com/chrisbanes/Android-PullToRefresh/。我跟着例子,但得到的錯誤 java.lang.NoSuchFieldError的:com.handmark.pulltorefresh.library.R $ id.pull_to_refresh_sub_text

這是我的網格:

<com.handmark.pulltorefresh.library.PullToRefreshGridView 
    xmlns:ptr="http://schemas.android.com/apk/res/com.abc.myproject" 
    android:id="@+id/gv_image" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:listSelector="#00000000" 
    android:padding="4dp" 
    android:horizontalSpacing="4dp" 
    android:verticalSpacing="4dp" 
    android:gravity="center" 
    android:numColumns="3" 
    android:columnWidth="128px" 
    android:stretchMode="columnWidth" 
    ptr:ptrMode="pullDownFromTop" 
    ptr:ptrDrawable="@drawable/android" /> 

當我跑我有以上例外。我將PullToRefresh添加爲工作空間中的另一個項目,並將其作爲我的項目庫。我還添加了Jar文件。我認爲錯誤是因爲行 xmlns:ptr =「http://schemas.android.com/apk/res/com.abc.myproject」?

我跟蹤了代碼,導致異常的行在LoadingLayout.java中: mSubHeaderText =(TextView)header.findViewById(R.id.pull_to_refresh_sub_text);

我做錯了什麼?

謝謝!

+0

我也有同樣的問題,你能解決你的問題嗎? –

回答

2

Android SDK工具r17添加了對庫中自定義屬性的自定義視圖的支持。使用自定義屬性佈局必須使用空間URI:

http://schemas.android.com/apk/res-auto

而不是將包括應用程序包名的URI的。這個URI在構建時被特定於應用程序的URI取代。

2

我有同樣的問題,

我做了什麼來解決它的參考庫從底部移動到列表的頂部。我認爲我曾經引用過一些與R.java中ID的生成相沖突的內容。

您可以在R.java中搜索pull_to_refresh_sub_text以確保它已正確生成。

相關問題