gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 13:32:49 24 4
gpt4 key购买 nike

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

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com