android - Chris Banes 的 Android-PullToRefresh java.lang.NoSuchFieldError : com. handmark.pulltorefresh.library.R$id.pull_to_refresh_sub_text

标签 android gridview refresh

我正在尝试使用 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);

我做错了什么吗?

谢谢!

最佳答案

Android SDK 工具 r17 添加了对库中具有自定义属性的自定义 View 的支持。使用自定义属性的布局必须使用命名空间 URI:

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

而不是包含应用程序包名称的 URI。此 URI 在构建时替换为应用特定的 URI。

关于android - Chris Banes 的 Android-PullToRefresh java.lang.NoSuchFieldError : com. handmark.pulltorefresh.library.R$id.pull_to_refresh_sub_text,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10937496/

相关文章:

php - php 提供下载后刷新

wordpress - 添加优惠券代码(wordpress)后如何刷新/重新加载 WooCommerce 结账页面?

javascript - 该函数可以工作,但报告 this.refresh() 不是一个函数

android - 如何通过点击后退按钮刷新 ListView - Android

asp.net - 提高gridview的分页性能?

android - GridView 中的项目不可见

gridview - 如何删除yii2中的摘要文本?

android - 更改 list 中的 minSdkVersion 后按钮变形

android - 在哪里可以获得所有 Android 设备的 Build.MODEL 名称列表?

android - Google Maps API v3 导航(如 Android 版 Google map )