[英]extends RecyclerView.Adapter not available
trying extend my class with "extends RecycleView.Adapter" but it seams like it is not "available" , I Rebuilded and cleaned up the project but it's no help. 尝试使用“ extends RecycleView.Adapter”扩展我的类,但它看起来像是“不可用”,我重新生成并清理了该项目,但没有帮助。 build.cradle : (in case that have anything to do with it)
build.cradle :(如果与它有任何关系)
minSdkVersion 15
targetSdkVersion 23
compileSdkVersion 23
buildToolsVersion "23.0.1"
(thank U for any help) (感谢您的帮助)
You have to import its library as follows : 您必须按以下方式导入其库:
compile 'com.android.support:recyclerview-v7:23.0.1'
Example : 范例:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:recyclerview-v7:23.0.1'
}
Make sure that you are importing import android.support.v7.widget.RecyclerView;
确保您要导入
import android.support.v7.widget.RecyclerView;
Your class should look like this : 您的课程应如下所示:
public class MyRecyclerViewAdapter extends RecyclerView.Adapter<MyRecyclerViewAdapter.CustomViewHolder> {
Had the same issue where I could not extend RecyclerView.Adapter and it was that I copied and pasted the following: 在无法扩展RecyclerView.Adapter的问题相同,是我复制并粘贴了以下内容:
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
but I should have replaced the :appcompat with :recyclerview 但我应该用:recyclerview替换:appcompat
Here is the correct lines in the dependencies section of the gradle script build.gradle: 这是gradle脚本build.gradle的dependencies部分中的正确行:
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.4.0'
Hope this helps someone wondering why they could not extend RecyclerView.Adapter 希望这有助于某人想知道为什么他们不能扩展RecyclerView.Adapter
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.